Stomp JMS Bindings
When using the Stomp Protocol with StompConnect or a JMS provider there are some additional Stomp headers and semantics which are useful to know. In terms of JMS semantics Stomp supports the same Ack Modes unless the messages are exchanged within a transaction via BEGIN/COMMIT/ABORT
Standard JMS Message Headers
The following standard JMS Headers are mapped to Stomp as follows; so these headers can be added to a SEND command when sending messages
Stomp header |
JMS header |
Description |
|---|---|---|
correlation-id |
JMSCorrelationID |
good consumes will add this header to any responses they send so that entire conversations can be correlated |
expires |
JMSExpiration |
the expiration time of the message |
persistent |
JMSDeliveryMode |
whether or not the message is persistent |
priority |
JMSPriority |
the priority on the message |
reply-to |
JMSReplyTo |
the destination you should send replies to |
type |
JMSType |
sets the type of the message |
Subscription headers
You can use an SQL 92 selector whenever you subscribe using the selector header
When subscribing for a topic you can specify the header
This will disable local messages. Namely messages published over the Stomp connection will not be received by this topic subscription.
Durable Topic Subscribers
If you wish to create a durable topic subscriber you will need to do the following
- set the client-id header on the CONNECT to a globally unique String for the Stomp connection
- set the durable-subscriber-name header on the SUBSCRIBE command.
The combination of the client-id and durable-subscriber-name uniquely identifies the durable topic subscription. i.e. after you restart your program and re-subscribe, the Broker will know which messages you need that were published while you were away
