Save This Page
Home » activemq-parent-5.3.1-source-release » org.apache » activemq » [javadoc | source]
org.apache.activemq
public class: ActiveMQMessageProducer [javadoc | source]
java.lang.Object
   org.apache.activemq.ActiveMQMessageProducerSupport
      org.apache.activemq.ActiveMQMessageProducer

All Implemented Interfaces:
    StatsCapable, Disposable, javax.jms.MessageProducer, Closeable

Direct Known Subclasses:
    ActiveMQTopicPublisher, ActiveMQQueueSender

A client uses a MessageProducer object to send messages to a destination. A MessageProducer object is created by passing a Destination object to a message-producer creation method supplied by a session.

MessageProducer is the parent interface for all message producers.

A client also has the option of creating a message producer without supplying a destination. In this case, a destination must be provided with every send operation. A typical use for this kind of message producer is to send replies to requests using the request's JMSReplyTo destination.

A client can specify a default delivery mode, priority, and time to live for messages sent by a message producer. It can also specify the delivery mode, priority, and time to live for an individual message.

A client can specify a time-to-live value in milliseconds for each message it sends. This value defines a message expiration time that is the sum of the message's time-to-live and the GMT when it is sent (for transacted sends, this is the time the client sends the message, not the time the transaction is committed).

A JMS provider should do its best to expire messages accurately; however, the JMS API does not define the accuracy provided.

Field Summary
protected  ProducerInfo info     
protected  boolean closed     
Fields inherited from org.apache.activemq.ActiveMQMessageProducerSupport:
session,  disableMessageID,  disableMessageTimestamp,  defaultDeliveryMode,  defaultPriority,  defaultTimeToLive,  sendTimeout
Constructor:
 protected ActiveMQMessageProducer(ActiveMQSession session,
    ProducerId producerId,
    ActiveMQDestination destination,
    int sendTimeout) throws JMSException 
Method from org.apache.activemq.ActiveMQMessageProducer Summary:
checkClosed,   close,   dispose,   getDestination,   getMessageSequence,   getProducerInfo,   getProducerStats,   getStartTime,   getStats,   getTransformer,   onProducerAck,   send,   setMessageSequence,   setProducerInfo,   setTransformer,   toString
Methods from org.apache.activemq.ActiveMQMessageProducerSupport:
checkClosed,   getDeliveryMode,   getDisableMessageID,   getDisableMessageTimestamp,   getPriority,   getSendTimeout,   getTimeToLive,   send,   send,   send,   setDeliveryMode,   setDisableMessageID,   setDisableMessageTimestamp,   setPriority,   setSendTimeout,   setTimeToLive
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.activemq.ActiveMQMessageProducer Detail:
 protected  void checkClosed() throws IllegalStateException 
    Check if the instance of this producer has been closed.
 public  void close() throws JMSException 
    Closes the message producer.

    Since a provider may allocate some resources on behalf of a MessageProducer outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

 public  void dispose() 
 public Destination getDestination() throws JMSException 
    Gets the destination associated with this MessageProducer.
 protected long getMessageSequence() 
 protected ProducerInfo getProducerInfo() 
 public JMSProducerStatsImpl getProducerStats() 
 protected long getStartTime() 
 public StatsImpl getStats() 
 public MessageTransformer getTransformer() 
 public  void onProducerAck(ProducerAck pa) 
 public  void send(Destination destination,
    Message message,
    int deliveryMode,
    int priority,
    long timeToLive) throws JMSException 
    Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.

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

 protected  void setMessageSequence(AtomicLong messageSequence) 
 protected  void setProducerInfo(ProducerInfo info) 
 public  void setTransformer(MessageTransformer transformer) 
    Sets the transformer used to transform messages before they are sent on to the JMS bus
 public String toString()