Share this page

# jms_publish_message_topic

Publishes messages to a specific topic.

Web Services Functions (SOAP, WEB_SERVICE, Silverlight)

    int jms_publish_message_topic( const char * StepName, const char * PublishedMessage, const char * TopicName );

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.
PublishedMessage | The message to send.
TopicName | The JNDI name of the topic from which to receive the message.

The jms_publish_message_topic function creates a publisher on a topic and publishes a message.

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

Insert the jms_set_message_property function before this statement to set a JMS header or property for the next message to be sent.

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 topic cannot be located.

- A communication error occurs.

## Example

This example shows sending and receiving messages for the topic testTopic on subscription subscription_1. Received messages are saved in the JMS_message parameter.

    jms_subscribe_topic("subscribe_step", "subscription_1", "testTopic");
    jms_publish_message_topic("publish_step", "message to publish", "testTopic");
    jms_receive_message_topic("receive_step", "subscription_1", "testTopic");
    lr_output_message(lr_eval_string("message : \n{JMS_message}\n"));

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: