Message Interface | Body Content |
---|---|
javax.jms.BytesMessage | array of bytes |
javax.jms.MapMessage | key-value pairs |
javax.jms.ObjectMessage | serialized Java object |
javax.jms.StreamMessage | stream of Java primitive values |
javax.jms.TextMessage | Java String object (used for XML) |
The message headers are used to provide information for message processing.
Header Field | Description |
---|---|
JMSCorrelationID | links one message to another |
JMSDeliveryMode | javax.jms.DeliveryMode.NON_PERSISTENT or javax.jms.DeliveryMode.PERSISTENT |
JMSDestination | Topic or Queue this message is bound for |
JMSExpiration | expiration value (default is never) |
JMSMessageID | message ID |
JMSPriority | priority level (default is 4) |
JMSRedelivered | is message being redelivered |
JMSReplyTo | Topic or Queue where a reply should be sent |
JMSTimestamp | message timestamp |
JMSType | message type supplied by client |
Properties added to the message are primarily used for message selection. Using a subset of the SQL92 syntax, a message consumer can filter what messages are delivered based on a message selector.
Acknowledgment Mode | Description |
---|---|
DUPS_OK_ACKNOWLEDGE | Session lazily acknowledges message delivery; minimizes Session overhead. |
AUTO_ACKNOWLEDGE | Session automatically acknowledges receipt of message after consumer finishes processing. |
CLIENT_ACKNOWLEDGE | Client calls Session.acknowledge() to acknowledge receipt of all messages received during the session. |
PERSISTENT messages are stored in persistent storage to be delivered at a later date if a client is unavailable. A JMS provider must deliver this kind of message once-and-only once, i.e., it cannot be lost and cannot be delivered more than once.
Clients can only interact with a message-driven bean through its associated JMS Destination, a non-durable/durable Topic or Queue. The onMessage() method is invoked in the transaction scope specified in the deployment descriptor. The only valid values are Required or NotSupported, because there can be no pre-existing transaction context or a client to handle exceptions. The other methods defined for a MessageDrivenBean, newInstance(), setMessageDrivenContext(), ejbCreate(), and ejbRemove() are called within an unspecified transaction context. Message-driven bean message acknowledgment is automatically handled by the container. An acknowledgment mode is only needed for bean-managed transaction demarcation, and then the only values available are AUTO_ACKNOWLEDGE (the default) and DUPS_OK_ACKNOWLEDGE.
The application uses the Java API for XML Binding (JAXB) 1.0 Early Access release to bind the XML messages to generated Java classes.
Note: These directions are specific to JBoss, but can easily be adapted to other application servers.
Also, the application requires Jakarta Ant to build, deploy, and run.