What is JMSType used for? Can it be used to define the message payload? For example, the payload might be for adding a product and the JMSType could be AddProduct.
JMSType is an optional header set by the JMS client. Its name is somewhat misleading because it has nothing to do with the type of message being sent ( BytesMessage , MapMessage , etc.). Its main purpose is to identify the message structure and type of payload; it is only supported by a couple of vendors.
The Java Message Service (JMS) was designed to make it easy to develop business applications that asynchronously send and receive business data and events. It defines a common enterprise messaging API that is designed to be easily and efficiently supported by a wide range of enterprise messaging products.
JMS messages have a basic format that is simple but highly flexible, allowing you to create messages that match formats used by non-JMS applications on heterogeneous platforms. A JMS message has three parts: a header, properties, and a body. Only the header is required.
JMS defines six message interface types; a base message type and five subtypes. The message types are defined according to the type of the message payload , where the payload is the body of a message that holds the content. JMS specifies only the interface and does not specify the implementation.
JMS Specification says "The JMSType
header field contains a message type identifier supplied by a
client when a message is sent. Some JMS providers use a message repository that contains the definitions of messages sent by applications. The type header field may reference a message’s
definition in the provider’s repository. JMS does not define a standard message definition repository, nor does it define a naming policy for the definitions it contains."
In effect, you can set JMSType
to a value of your choice but it is suggested you make sure every application that runs on your JMS provider use the same values for JMSType
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With