JMS transport
The JMS (Java Message Service) transport layer is a J2EE standard for sending messages, either text or Java objects, between Java clients.
JMS transport communication scenarios
The following communication scenarios are used for the JMS transport:
-
Peer-to-Peer. Also known as Point-to-Point. JMS implements point-to-point messaging by defining a message queue as the target for a message. Multiple senders send messages to a message queue, and the receiver gets the message from the queue.
VuGen supports point-to-point communication by allowing you to send and receive JMS messages to and from a queue.
-
Publish-Subscribe. Each message is sent from one publisher to many subscribers through a designated topic. The subscribers only receive messages sent after they have subscribed.
Before you can send messages over JMS transport, you need to configure several items that describe the transport:
-
JNDI initial context factory. The name of the factory class that creates an initial context to use to locate the JMS resources, such as JMS connection factory or JMS queue.
-
JNDI provider. The URL of the service provider to use to locate the JMS resources, such as JMS connection factory or JMS queue.
-
JMS connection factory. The JNDI name of the JMS connection factory.
In addition, you can set a timeout for received messages and the number of JMS connections per process.
You configure these settings through the JMS runtime settings. For details, see the JMS > Advanced view.
JMS script functions
VuGen uses its API functions to implement the JMS transport. Each function begins with a jms prefix:
Function Name
|
Description
|
---|---|
jms_publish_message_topic
|
Publishes messages to a specific topic
|
jms_receive_message_queue
|
Receives a message from a queue
|
jms_receive_message_topic
|
Receives published messages to a specific topic on a subscription.
|
jms_send_message_queue
|
Sends a message to a queue.
|
jms_send_receive_message_queue
|
Sends a message to a specified queue and receives a message from a specified queue.
|
jms_subscribe_topic
|
Creates a subscription for a topic.
|
jms_set_general_property
|
Sets a general property in the user context.
|
jms_set_message_property
|
Sets a JMS header or property for the next message to be sent, or uses a JMS header or property to filter received messages.
|
The JMS steps/functions are only available when manually creating scripts—you cannot record JMS messages sent between the client and server.
Unlike peer-to-peer communication that uses message queues, the publish-subscribe functions, jms_publish_message_topic, jms_subscribe_topic, and jms_receive_message_topic, are not supported for Web Service calls. To use these functions with Web Service calls, you must manually set up user handlers to generate the JMS message payload. For more information, see Create a user handler.
For details about the JMS functions, see the Function Reference.
JMS message structure
Each JMS message is composed of:
-
Header. contains standard attributes (Correlation ID, Priority, Expiration date).
-
Properties. custom attributes.
-
Body. text or binary information.
JMS can be sent with several message body formats. Two common formats are TextMessage and BytesMessage.
To override the default behavior, use a jms_set_general_property function before sending the message. Set the JMS_MESSAGE_TYPE property to TextMessage, BytesMessage, or Default.
For example:
jms_set_general_property("step1","JMS_MESSAGE_TYPE","BytesMessage");
Known issues
If IP spoofing is enabled for a Web Services script using JMS transport, you should add an additional parameter to the runtime settings.
-
Open Runtime Settings > JMS > Advanced
-
In the Java Message Service section, add the following to the Additional VM parameters field:
-Djava.net.preferIPv4Stack=true
See also: