O'Reilly - Java Message Service
O'Reilly - Java Message Service
O'Reilly - Java Message Service
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />
<strong>Message</strong>s come in various types that are defined by the payload they carry. The payload<br />
itself might be very structured, as with Stream<strong>Message</strong> and Map<strong>Message</strong> objects, or fairly<br />
unstructured, as with Text<strong>Message</strong>, Object<strong>Message</strong>, and Bytes<strong>Message</strong> types. <strong>Message</strong>s can<br />
carry important data or simply serve as notifications of events in the system. In most cases,<br />
messages are both notifications and vehicles for carrying data.<br />
The message headers provide metadata about the message describing who or what created<br />
the message, when it was created, how long the data is valid, etc. The headers also contain<br />
routing information that describes the destination of the message (topic or queue), how a<br />
message should be acknowledged, and a lot more. In addition to headers, messages can<br />
carry properties that can be defined and set by the JMS client. JMS consumers can choose<br />
to receive messages based on the values of certain headers and properties, using a special<br />
filtering mechanism called message selectors.<br />
3.1 Headers<br />
Every JMS message has a set of standard headers. Each header is identified by a set of<br />
accessor and mutator methods that follow the idiom setJMS( ), getJMS(<br />
). Here is a partial definition of the <strong>Message</strong> interface that shows all the JMS header<br />
methods:<br />
public interface <strong>Message</strong> {<br />
}<br />
public Destination getJMSDestination( ) throws JMSException;<br />
public void setJMSDestination(Destination destination)<br />
throws JMSException;<br />
public int getJMSDeliveryMode( ) throws JMSException;<br />
public void setJMSDeliveryMode(int deliveryMode)<br />
throws JMSException;<br />
public String getJMS<strong>Message</strong>ID( ) throws JMSException;<br />
public void setJMS<strong>Message</strong>ID(String id) throws JMSException;<br />
public long getJMSTimestamp( ) throws JMSException;<br />
public void setJMSTimestamp(long timestamp) throws JMSException;<br />
public long getJMSExpiration( ) throws JMSException;<br />
public void setJMSExpiration(long expiration) throws JMSException;<br />
public boolean getJMSRedelivered( ) throws JMSException;<br />
public void setJMSRedelivered(boolean redelivered)<br />
throws JMSException;<br />
public int getJMSPriority( ) throws JMSException;<br />
public void setJMSPriority(int priority) throws JMSException;<br />
public Destination getJMSReplyTo( ) throws JMSException;<br />
public void setJMSReplyTo(Destination replyTo) throws JMSException;<br />
public String getJMSCorrelationID( ) throws JMSException;<br />
public void setJMSCorrelationID(String correlationID)<br />
throws JMSException;<br />
public byte[] getJMSCorrelationIDAsBytes( ) throws JMSException;<br />
public void setJMSCorrelationIDAsBytes(byte[] correlationID)<br />
throws JMSException;<br />
public String getJMSType( ) throws JMSException;<br />
public void setJMSType(String type) throws JMSException;<br />
34