The Message Consumer step lets you consume asynchronous messages in a test case. This step can attach to a known queue or topic and can get messages posted for this subscriber. You identify yourself with a unique key. You must have already subscribed to the queue or topic and the messages were pushed to that destination.
Prerequisite: You must have the demo server running before you execute the example test case.
Parameter Requirements: Knowledge of the queue or topic being used in the application under test.
The Message Consumer step has a default name using this convention: Listen on subscribe-queuename. Before the queuename is entered, the default step name is Async JMS. If another step uses the default step name, DevTest appends a number to this step name to keep it unique. You can change step names at any time.
Review the async-consumer-jms.tst test case in the examples project to see what is being described in this section. The following graphic shows the async-consumer-jms.tst test case.
The create-consumer step subscribes to asynchronous message (topic/testTopic) using the Async Key (EXAMPLE-ASYNC-WRAPPER). The send-message step publishes message to a queue (queue/C). The number of messages to be published is controlled using a data set (counterA). The message consumer step has an Async queue (EXAMPLE-ASYNC-WRAPPER) using which message subscribed by the create-consumer step is consumed. The number of messages to be consumed is controlled using the data set (DataSetB).
Note: The Async Key specified in create-consumer and consumer steps must match.
The following graphic shows an example of the subscriber section of a step.
To set up and enable the ability to listen to (subscribe to) messages, select the enable check box.
Notice that an asynchronous topic is specified in the Type field, and an Async Key parameter is defined. This key is necessary as an input in the current step.
The following graphic shows an example of the publisher section of a step.
To set up the ability to send (publish) messages, select the enable check box. To execute a commit when the message is sent, select the use transaction check box.
Enter the following parameters:
The name of the topic or queue. Use Search to browse the JNDI server for the topic or queue name.
Select whether you are using a topic or queue. To see what messages are waiting to be consumed from a queue (only), use Browse to the right of this field.
Select the type of message you are sending. The supported types are Empty, Text, Object, Bytes, Message, and Mapped (Extended).
Displays a panel where you can edit the message headers and can add message properties.
Enter the following parameters:
Enter or select the Async Key parameter that was named in a preceding subscriber step (EXAMPLE-ASYNC-WRAPPER). These names must match.
Enter the interval, in seconds, to wait for the next message.
Specifies the action to take or the step to go to if the test fails because of an environment error.
Default: Abort the test.
The wrapper status contains two output status values:
If some messages are waiting, they can be read by clicking Next Message. The Complex Object Editor displays the message.
You are now ready to manipulate this object.
A wrapper is a FIFO list for holding responses from asynchronous topics and queues. A wrapper provides a place for the application to put responses for consumption later. Messages wait in this list for subsequent processing (in this Message Consumer step).
Copyright © 2014 CA Technologies.
All rights reserved.
|
|