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.
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) |
- 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