Class TopicPublisher

    • Constructor Detail

      • TopicPublisher

        TopicPublisher​(TopicSession sess,
                       Destination topic)
                throws JMSException
        Constructs a publisher.
        Parameters:
        sess - The session the publisher belongs to.
        topic - The topic the publisher publishs messages on.
        Throws:
        IllegalStateException - If the connection is broken.
        JMSException - If the creation fails for any other reason.
    • Method Detail

      • toString

        public String toString()
        Returns a string view of this receiver.
        Overrides:
        toString in class Object
      • publish

        public void publish​(Message message,
                            int deliveryMode,
                            int priority,
                            long timeToLive)
                     throws JMSException
        API method. Sends a message to a topic with default delivery parameters.
        Specified by:
        publish in interface TopicPublisher
        Parameters:
        message - the message to send.
        deliveryMode - the delivery mode to use.
        priority - the priority for this message.
        timeToLive - the message's lifetime in milliseconds.
        Throws:
        IllegalStateException - If the publisher is closed, or if the connection is broken.
        JMSException - If the request fails for any other reason.
      • publish

        public void publish​(Message message)
                     throws JMSException
        API method. Sends a message to a topic with default delivery parameters.
        Specified by:
        publish in interface TopicPublisher
        Parameters:
        message - the message to send.
        Throws:
        IllegalStateException - If the publisher is closed, or if the connection is broken.
        JMSException - If the request fails for any other reason.
      • publish

        public void publish​(Topic topic,
                            Message message)
                     throws JMSException
        API method. Sends a message to a topic for an unidentified topic publisher with default delivery parameters.

        Typically, a topic publisher is assigned a topic at creation time; however, the JMS API also supports unidentified topic publisher, which require that the topic be supplied every time a message is sent.

        Specified by:
        publish in interface TopicPublisher
        Parameters:
        topic - the topic to send this message to.
        message - the message to send.
        Throws:
        IllegalStateException - If the publisher is closed, or if the connection is broken.
        JMSException - If the request fails for any other reason.
      • publish

        public void publish​(Topic topic,
                            Message message,
                            int deliveryMode,
                            int priority,
                            long timeToLive)
                     throws JMSException
        API method. Sends a message to a topic for an unidentified topic publisher with given delivery parameters.

        Typically, a topic publisher is assigned a topic at creation time; however, the JMS API also supports unidentified topic publisher, which require that the topic be supplied every time a message is sent.

        Specified by:
        publish in interface TopicPublisher
        Parameters:
        topic - the topic to send this message to.
        message - the message to send.
        deliveryMode - the delivery mode to use.
        priority - the priority for this message.
        timeToLive - the message's lifetime in milliseconds.
        Throws:
        IllegalStateException - If the publisher is closed, or if the connection is broken.
        JMSException - If the request fails for any other reason.