Subscribing to messages

You can retrieve MQ messages from a queue by using the Subscribe action in HCL OneTest™ API tests.

Watch or participate

The MQ transport can either watch or participate in queue messaging subscriptions.

Note: The recording method that you define in the Recording Mode section of the Recording tab in the MQ physical transport determines how monitoring functions for both recording and watch mode. For information about defining recording methods, see Recording settings.

In Participate mode, messages are pulled off the queue. It could be undesirable in a testing scenario since a queue message might go to only one connected client. In this case, the HCL OneTest API connection prevents other systems from receiving the messages. If it is a problem, use the Watch option.

In Watch mode, HCL OneTest API sets up an event monitor in the same way that it records a queue. This event monitoring is controlled by the recording mode in the physical MQ transport resource.

For example:

If the recording mode is Dynamic Mirror Queues, a temporary mirror queue is set up by HCL OneTest API which 'mirrors' the queue in question. HCL OneTest API then takes messages from this mirror queue.

If the recording mode is Proxy Queues, HCL OneTest API takes messages from the proxy queue and then forwards the messages to the real queue.

In summary, each type of recording mode causes the watching subscriber to receive a message through a slightly different mechanism, which is true both for watch mode and for recording.

The following table describes how different subscriber settings affect watch mode and recording.

Subscriber setting Result
If you have two subscribers that use the same transport and are watching the same queue Both subscribers receive the message
If two transports that are used by two different subscribers, are using different recording modes Both subscribers receive the messages. Each mode defines messages to be taken from a different underlying IBM® WebSphere MQ object, for example a proxy queue or a mirror queue
If two transports that are used by two different subscribers, both have Dynamic Mirror Queues selected Both subscribers receive the message, which is because each transport uses a different mirror queue
If two transports that are used by two different subscribers, both have Queue Browsing is selected Both subscribers receive the messages (assuming that the live system did not take the message from the queue before the browse occurred)
For all other types of recording modes, this is the result:
  • If subscribers use different transports, they compete for messages on a particular queue
  • Subscribers have the same recording mode that is selected and the same configuration for that recording mode
Note: If you are using Dynamic Mirror Queues, Mirror Queues, or Queue Aliasing recording modes, you must use WebSphere MQ version 7.1 and later.
Note: There is a difference in behavior between Queue Browsing and all other recording modes. The Queue Browsing mode receives all messages on the queue that is being watched, including those messages that were received before the watching began. All other modes receive messages that exist while the queue is being watched. Any messages that existed on the queue before the watching began is not received by the watching subscriber, which also applies to recording.
Feedback