Before deep-diving into the JMS sub-topics, lets discuss in details some of the core components constituting JMS. Understanding these components is very relevant to keep up with the various terminologies used through this Chapter and other Chapters based on this. The core components of JMS are as follows:
The interaction between these core components in the JMS ecosystem can be pictorially represented as shown in Figure 18-6 below.
Figure 18-6. Interaction between core components in JMS
In the following section we will cover these core components in detail for your clear understanding.
JMS provides different messages for different content, but all messages have a similar structure and they are all derived from the standard javax.jms.Message interface.
A typical message consists of a message header, optional message properties and message body.
Message header is a mandatory component in a message and is used for routing and identifying the message. They typically consists of key-value pairs and are set automatically by the JMS message provider during producing and consuming of messages and some are set by the JMS client on message to message basis as the case may be.
The various header fields of the Message interface can be summarized as shown in Table 18-1 below.
Table 18-1. JMS header field details
|JMSMessageID||String||It uniquely identifies each message that is sent by the provider. This field is set by the provider during the send process.|
|JMSDestination||javax.jms.Destination||The Destination to which the message is sent. It is set by the provider during the send process.|
|JMSDeliveryMode||int||Possible values are: DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT. A persistent message is delivered “once and only once”and a non-persistent message is delivered “at most once.”|
|JMSTimestamp||long||The time that the message was delivered to a provider to be sent. It is set by the provider during the send process.|
|JMSExpiration||long||The time when a message should expire. Expired messages will not be delivered by the provider. A value of 0 means that the message will never expire.|
|JMSPriority||int||The priority of the message which is set by the provider during the send process. 0 being the lowest and 9 being the highest priority.|
|JMSCorrelationID||String||Used to link a response message with a request message and is set by the JMS program when sending the message.|
|JMSReplyTo||javax.jms.Destination||Used by a requesting program to indicate where a reply message should be sent and is set by the JMS program while sending the message.|
|JMSType||String||Type of the message.|
|JMSRedelivered||boolean||Indicates that the message was delivered earlier to the JMS program, but the program did not acknowledge its receipt. This is set by the provider during the message receiving process.|
Page Visitors: 13487