Share this page

# jms_send_receive_message_queue

Sends a message to a specified queue and receives a message from a specified queue.

Web Services Functions (SOAP, WEB_SERVICE, Silverlight)

    int jms_send_receive_message_queue( const char * StepName, const char * SentMessage, const char * SendQueueName, const char * ReceiveQueueName );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All input string arguments (char type) except the step name can be parameterized using standard parameterization.

StepName | The name of the step, as it appears in the test tree. Any text can be used.
SentMessage | The message to send.
SendQueueName | The JNDI name of the send queue.
ReceiveQueueName | The JNDI name of the queue to receive from.

The jms_send_receive_message_queue function sends a message to the queue specified by the SendQueueName argument and receives a message from queue specified by the ReceiveQueueName argument.

VuGen identifies the queues by calling a lookup method on a JNDI context defined in the JMS runtime settings.

If the ReceiveQueueName value is empty, a temporary queue is used.

The sent message type is defined in the contentType message header. The default is a text message.

When received, the message is saved in a VuGen output parameter called JMS_message.

If a JMSCorrelationID message header is set by a call to the jms_set_message_property function before this function, only the next message with the same JMSCorrelationID header is received.

If a JMSSelector message header is set by a call to the jms_set_message_property before this function, that selector's expression is used for filtering the received message.

If both a JMSCorrelationID and JMSSelector are used, only the JMSSelector is set.

This function fails, causing the script to stop (if the Continue on Error runtime setting is not selected) if:

- The JNDI context is incorrect.

- The SendQueueName queue cannot be found.

- A non-empty ReceiveQueueName queue is specified and cannot be found.

- No message arrives after the timeout configured in the runtime settings.

- A communication error occurs.

## Example

This example shows sending and receiving a message on a queue.

    jms_set_message_property("step0: set and filter by the JMSCorrelationID",
        "JMSCorrelationID",
        "VuserID-{VuserID}");

    jms_send_receive_message_queue("step1: send and receive message",
        "Test Message",
        "weblogic.jms.inqueue",
        "weblogic.jms.outqueue");

    lr_message(lr_eval_string("{JMS_message}"));

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: