Name

MessageProducer

Synopsis

Clients use MessageProducers to send messages. MessageProducers can be tied to a specific Destination, and any messages sent through the producer are addressed to the Destination specified when it was created. If a Destination is not specified when a MessageProducer is created, then a Destination has to provided for each message sent. Methods to create MessageProducers are provided by subclasses of the Session interface (e.g., TopicSession, QueueSession).

The MessageProducer has a default delivery mode, priority and time-to-live for messages that it sends. There are get and set methods for these default properties. If these properties are specified on a message, they override the defaults of the MessageProducer.

public interface MessageProducer {
// Property Accessor Methods (by property name)
   public abstract int getDeliveryMode() throws JMSException;  
   public abstract void setDeliveryMode(
        int deliveryMode) throws JMSException;  
   public abstract boolean getDisableMessageID(
        ) throws JMSException;  
   public abstract void setDisableMessageID(
        boolean value) throws JMSException;  
   public abstract boolean getDisableMessageTimestamp(
        ) throws JMSException;  
   public abstract void setDisableMessageTimestamp(
        boolean value) throws JMSException;  
   public abstract int getPriority() throws JMSException;  
   public abstract void setPriority(
        int defaultPriority) throws JMSException;  
   public abstract long getTimeToLive() throws JMSException;  
   public abstract void setTimeToLive( long ...

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.