Class TemporaryTopic

  • All Implemented Interfaces:
    jakarta.jms.Destination, jakarta.jms.TemporaryTopic, jakarta.jms.Topic, Serializable, Referenceable, DestinationMBean, TopicMBean

    public class TemporaryTopic
    extends Topic
    implements jakarta.jms.TemporaryTopic
    Implements the jakarta.jms.TemporaryTopic interface.

    A TemporaryTopic object is a Topic object created for the duration of a Connection. It is a system-defined topic that can be consumed only by the Connection that created it. A TemporaryTopic object can be created either at the Session or TopicSession level.

    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        define serialVersionUID for interoperability
        See Also:
        Constant Field Values
      • cnx

        private Connection cnx
        The connection the topic belongs to, null if not known.
    • Constructor Detail

      • TemporaryTopic

        public TemporaryTopic()
      • TemporaryTopic

        public TemporaryTopic​(String agentId,
                              Connection cnx)
        Constructs a temporary topic.
        Parameters:
        agentId - Identifier of the topic agent.
        cnx - The connection the queue belongs to, null if not known.
    • Method Detail

      • toString

        public String toString()
        Returns a String image of the topic.
        Specified by:
        toString in interface jakarta.jms.Topic
        Overrides:
        toString in class Topic
        Returns:
        A provider-specific identity values for this topic.
      • delete

        public void delete()
                    throws jakarta.jms.JMSException
        API method. Deletes this temporary topic. If there are existing subscribers still using it, a JMSException will be thrown.
        Specified by:
        delete in interface DestinationMBean
        Specified by:
        delete in interface jakarta.jms.TemporaryTopic
        Overrides:
        delete in class Destination
        Throws:
        IllegalStateException - If the connection is closed or broken.
        jakarta.jms.JMSException - If the request fails for any other reason.
      • getCnx

        Connection getCnx()
        Returns the connection this temporary topic belongs to, null if not known.