Name

TopicPublisher

Synopsis

A TopicPublisher is a MessageProducer specific to a publish/subscribe context. TopicPublishers are created using the createPublisher() method on a TopicSession. A TopicPublisher is created with a Topic under which it publishes messages. A client can override the default Topic using one of the publish() methods that accepts a Topic as an argument along with the Message to be sent. Sending a Message without a Topic (i.e., the TopicPublisher was created with a null Topic and the Message was sent without specifying a Topic), causes an InvalidDestinationException to be thrown.

                  Implementations
public interface TopicPublisher extends MessageProducer {
// Public Instance Methods
   public abstract Topic getTopic() throws JMSException;  
   public abstract void publish(
        javax.jms.Message message) throws JMSException;  
   public abstract void publish(Topic topic, 
        javax.jms.Message message) throws JMSException;  
   public abstract void publish(javax.jms.Message message, 
        int deliveryMode, int priority, 
        long timeToLive) throws JMSException;  
   public abstract void publish(Topic topic, 
        javax.jms.Message message, int deliveryMode, 
        int priority, 
        long timeToLive) throws JMSException;  
}

Returned By

TopicSession.createPublisher()

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.