Class RMQDestination

  • All Implemented Interfaces:
    jakarta.jms.Destination, jakarta.jms.Queue, jakarta.jms.TemporaryQueue, jakarta.jms.TemporaryTopic, jakarta.jms.Topic, java.io.Serializable, javax.naming.Referenceable

    public class RMQDestination
    extends java.lang.Object
    implements jakarta.jms.Queue, jakarta.jms.Topic, jakarta.jms.Destination, javax.naming.Referenceable, java.io.Serializable, jakarta.jms.TemporaryQueue, jakarta.jms.TemporaryTopic
    Implementation of a Topic and Queue Destination.

    This implementation is Serializable so it can be stored in a JNDI naming context. It is also Referenceable for the same purpose.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      RMQDestination()
      Constructor used only for Java serialisation
      RMQDestination​(java.lang.String destName, boolean isQueue, boolean isTemporary)
      Creates a destination for RJMS
      RMQDestination​(java.lang.String destName, boolean isQueue, boolean isTemporary, java.util.Map<java.lang.String,​java.lang.Object> queueDeclareArguments)
      Creates a destination for RJMS with arguments to declare the AMQP queue
      RMQDestination​(java.lang.String destName, java.lang.String amqpExchangeName, java.lang.String amqpRoutingKey, java.lang.String amqpQueueName)
      Creates a destination for RJMS mapped onto an AMQP queue/destination.
    • Constructor Detail

      • RMQDestination

        public RMQDestination()
        Constructor used only for Java serialisation
      • RMQDestination

        public RMQDestination​(java.lang.String destName,
                              boolean isQueue,
                              boolean isTemporary)
        Creates a destination for RJMS
        Parameters:
        destName - the name of the topic or queue
        isQueue - true if this represent a queue
        isTemporary - true if this is a temporary destination
      • RMQDestination

        public RMQDestination​(java.lang.String destName,
                              boolean isQueue,
                              boolean isTemporary,
                              java.util.Map<java.lang.String,​java.lang.Object> queueDeclareArguments)
        Creates a destination for RJMS with arguments to declare the AMQP queue
        Parameters:
        destName - the name of the topic or queue
        isQueue - true if this represent a queue
        isTemporary - true if this is a temporary destination
        queueDeclareArguments - arguments to use when declaring the AMQP queue
      • RMQDestination

        public RMQDestination​(java.lang.String destName,
                              java.lang.String amqpExchangeName,
                              java.lang.String amqpRoutingKey,
                              java.lang.String amqpQueueName)
        Creates a destination for RJMS mapped onto an AMQP queue/destination.

        amqpExchangeName and amqpRoutingKey must both be null if either is null, and amqpQueueName may be null, but at least one of these three parameters must be non-null.

        Parameters:
        destName - the name of the queue destination
        amqpExchangeName - - the exchange name for the mapped resource
        amqpRoutingKey - - the routing key for the mapped resource
        amqpQueueName - - the queue name of the mapped resource
    • Method Detail

      • isAmqpWritable

        public boolean isAmqpWritable()
      • isAmqpReadable

        public boolean isAmqpReadable()
      • isAmqp

        public boolean isAmqp()
        Returns:
        true if this is an AMQP 0-9-1 mapped resource, false otherwise
      • setAmqp

        public void setAmqp​(boolean amqp)
        For JNDI binding and Spring beans
        Parameters:
        amqp - set to true if this is an AMQP 0-9-1 mapped resource, false otherwise
      • getAmqpQueueName

        public java.lang.String getAmqpQueueName()
      • setAmqpQueueName

        public void setAmqpQueueName​(java.lang.String amqpQueueName)
        For JNDI binding and Spring beans
        Parameters:
        amqpQueueName - AMQP 0-9-1 queue name
      • getAmqpExchangeName

        public java.lang.String getAmqpExchangeName()
      • setAmqpExchangeName

        public void setAmqpExchangeName​(java.lang.String amqpExchangeName)
        For JNDI binding and Spring beans
        Parameters:
        amqpExchangeName - AMQP 0-9-1 exchange name to use
      • getDestinationName

        public java.lang.String getDestinationName()
      • setDestinationName

        public void setDestinationName​(java.lang.String destinationName)
        For JNDI binding and Spring beans
        Parameters:
        destinationName - JMS destination name
      • getAmqpRoutingKey

        public java.lang.String getAmqpRoutingKey()
        Returns:
        AMQP 0-9-1 routing key
      • setAmqpRoutingKey

        public void setAmqpRoutingKey​(java.lang.String routingKey)
        For JNDI binding and Spring beans
        Parameters:
        routingKey - AMQP 0-9-1 routing key
      • getAmqpExchangeType

        public java.lang.String getAmqpExchangeType()
        Internal use only
        Returns:
        AMQP 0-9-1 exchange type used
      • noNeedToDeclareExchange

        public boolean noNeedToDeclareExchange()
        Internal use only
      • isQueue

        public boolean isQueue()
        Returns:
        true if this is a queue, false if it is a topic
      • setQueue

        public void setQueue​(boolean isQueue)
        Set to true if this is a queue, false if this is a topic - should only be used when binding into JNDI
        Parameters:
        isQueue - true if this is a queue, false otherwise
        Throws:
        java.lang.IllegalStateException - if the queue has already been declared isDeclared() return true
      • getTopicName

        public java.lang.String getTopicName()
                                      throws jakarta.jms.JMSException
        Specified by:
        getTopicName in interface jakarta.jms.Topic
        Throws:
        jakarta.jms.JMSException
      • getQueueName

        public java.lang.String getQueueName()
                                      throws jakarta.jms.JMSException
        Specified by:
        getQueueName in interface jakarta.jms.Queue
        Throws:
        jakarta.jms.JMSException
      • getReference

        public javax.naming.Reference getReference()
                                            throws javax.naming.NamingException
        Specified by:
        getReference in interface javax.naming.Referenceable
        Throws:
        javax.naming.NamingException
      • getQueueDeclareArguments

        public java.util.Map<java.lang.String,​java.lang.Object> getQueueDeclareArguments()
      • isDeclared

        public boolean isDeclared()
        For internal use only.
        Returns:
        true if we have declared RabbitMQ resources to back this destination
      • setDeclared

        public void setDeclared​(boolean isDeclared)
        For internal use only.
        Parameters:
        isDeclared - - set to true if the queue/topic has been defined in the RabbitMQ broker
        See Also:
        isDeclared()
      • isTemporary

        public boolean isTemporary()
        Returns:
        true if this is a temporary destination, false otherwise
      • delete

        public void delete()
                    throws jakarta.jms.JMSException
        This method is for TemporaryQueues only — deletion currently occurs automatically on session close.
        Specified by:
        delete in interface jakarta.jms.TemporaryQueue
        Specified by:
        delete in interface jakarta.jms.TemporaryTopic
        Throws:
        jakarta.jms.JMSException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface jakarta.jms.Queue
        Specified by:
        toString in interface jakarta.jms.Topic
        Overrides:
        toString in class java.lang.Object