Introduction
The Java Message Service API is a communication standard that allows Java Platform Enterprise Edition (Java EE) application components to generate, transmit, receive, and read messages. It provides loosely connected, dependable, and asynchronous distributed communication.
In this article, we will discuss the introduction to JMS, and JMS Messages in ReadyAPI.
JMS Messages in ReadyAPI
JMS Messages in ReadyAPI support the TextMessage and BytesMessage objects (for sending the messages) as well as the TextMessage, BytesMessage, and MapMessage objects (for incoming messages).
Message Header
You can select the Send As BytesMessage check box and convert messages to the BytesMessage format in the JMS Header panel easily.

If the request contains an attachment, it will be used as a payload of the message.
Selecting the Type of the Message
If the attachment's content type is text, plain, or XML, the message will be delivered as TextMessage unless the Send As BytesMessage check box is deselected.
When you receive a BytesMessage message, the payload will be displayed in the XML response editor if it is an XML document or a response attachment.
EBCIDIC requests are not properly encoded due to an unresolved problem, even when the encoding property is set to IM-037.
Use the following line to add explicit encoding to the vmoptions file:
-Dfile.encoding=UTF8
BytesMessage
BytesMessage messages are made up of a series of uninterpreted bytes. This message type is used to encode the message body so that it can adhere to an existing message format. A message is represented as an array of bytes in Java. This format is commonly used to connect to external messaging systems that have a binary protocol for the message formats described.
For both outgoing and incoming messages, ReadyAPI supports the BytesMessages message type. To convert a message to the BytesMessage format, check the Send As BytesMessage check box in the JMS Header inspector.

JMS Message Header
The JMS header contains system-specific information that is shared by all messages with JMS content, such as the message destination and time of transmission. The body only contains application-specific data.
The header could also contain application-specific information in the form of keyword/value properties. However, not all providers allow the storage of an arbitrary quantity of data in the header.
| Header Type | Description |
| JMDCorrelationID | JMSCorrelationID connects a message to another message or application-specific ID. Normally, this value is used to determine which message receives a response. |
| JMSReplyTo | JMSReplyTo specifies the JMS topic or JMS queue where responses should be sent. |
| JMSType | JMSType is the most important header value, and it is a string that is used to determine the type of message being sent. The JMSType value is commonly used by handlers to identify how to handle an incoming message. |
| JMSPriority | JMSPriority shows the message's importance on a scale of 0 to 9. When we get 0, it will be a low rating, and 9 will be a high rating. When you get the number 4, it suggests a normal priority, while the value of 5 indicates a high priority. |
| JMSDeliveryMode |
The JMS delivery mode ensures that the message is not lost in transit. PERSISTENT and NON-PERSISTENT are the two possible values. PERMANENT communications cannot be lost during a transition.
|
| TimetoLive | It Specifies the length of time which is a valid request. The request will never expire if it sets to zero. |
| Send As ByteMessage | It Sets the type of outgoing messages to BytesMessage. |
| Add SoapAction as a property | It adds the SOAPJMS_soapAction and SOAPAction and adds the properties that contain the same value as the Soap Action Method property. |
| Durable Subscription Name | It sets the durable subscription name, and the default name was durableSubscription + topic_name. |
| ClientID | It sets the client ID for a JMS connection. |
| Message Selector |
Message selectors can be specified in JMS request headers. The clients who subscribe to topics can set up message selectors to filter out communications that they do not require. Message selectors can only be specified in header elements.
For example, clients can define a message selector that will display only the message with the JMSType atg.das.Startup. The message selector is able to refer to both system- and application-specific header properties.
|
Response Header
We will use the JMS panel to examine the headers of the response message.

| Property | Description |
| JMSMessageID | It is associated with the message with a unique identifier. You can easily use JMSMessageID values to identify the messages in the historical repositories. |
| JMSDestination | It determines the destination object through which the current message can be sent. |
| JMSExpiration | It gets the expiration date of a current message. When the date is expired, the message can not be sent. |
| JMSRedelivered | It gets the boolean that indicates whether the current message is redelivered or not. |
| JMDCorrelatonID | JMSCorrelationID connects a message to another message or application-specific ID. Normally, this value is used to determine which message receives a response. |
| JMSTimeStamp | It indicates the time required to find the current message received. It is also useful to determine the duration between the time when the message is sent and when it is received. |
| JMSReplyTo | JMSReplyTo specifies the JMS topic or JMS queue where responses should be sent. |
| JMSType | JMSType is the most important header value, and it is a string that is used to determine the type of message being sent. The JMSType value is commonly used by handlers to identify how to handle an incoming message. |
| JMSPriority | JMSPriority shows the message's importance on a scale of 0 to 9. When we get 0, it will be a low rating, and 9 will be a high rating. When you get the number 4, it suggests a normal priority, while the value of 5 indicates a high priority. |
| JMSDeliveryMode |
The JMS delivery mode ensures that the message is not lost in transit. PERSISTENT and NON-PERSISTENT are the two possible values. PERMANENT communications cannot be lost during a transition. |
MapMessage
MapMessage is a collection of name and value pairs for names and primitive value types which represent in Java String objects. The entries can be accessed successively or randomly by the enumerator, and the order of the entries is arbitrary.
ReadyAPI only supports MapMessage for incoming messages.
ObjectMessage
A serializable object is referenced by ObjectMessage. In virtual APIs, ReadyAPI supports StreamMessage.
StreamMessage Object
StreamMessage is a collection of primitive types that can be read successively from the message body. StreamMessage can also be used on virtual computers.
Primitive types are treated as objects and are explicitly handled.
Note: The Stream Message object has been deprecated since ActiveMQ 4.2. Otherwise, use the Blob Message object.
TextMessage
TextMessage is a text block. It can be used to express a message as an XML file and is represented as the String in Java.TextMessages are supported in both outgoing and incoming messages by ReadyAPI.
JMS Property Panel
We can use a JMS Property panel to add, modify, and remove the JMS request properties:

Some properties are described below:
▶️Key: It is the JMS property identifier.
▶️Value: It is the JMS property value.
If you want to add a new property then click on the ➕sign and to remove click on the ❌sign at the top of the toolbar.




