How do you subscribe to a single message on a queue without removing others using IBM Rational Integration Tester (RIT) of IBM Rational Test Workbench?
You need to extract a single message from an IBM WebSphere MQ queue based on its message content. You must not remove any other messages from the queue as they are used by other consumers or applications.
This solution uses IBM WebSphere MQ as the messaging system and contains an attachment of a sample project to demonstrate it.
Usually you take a specific message from a queue by using a combination of the queue name and a unique identifier. An example is: Message ID or Correlation ID. The assumption is that you do not know the message identifiers, but you do know what the message payload will contain.
The following are high-level steps, the example project has a working test with comments.
- Create a physical IBM WebSphere MQ transport in Architecture School.
- Create a logical IBM WebSphere MQ transport and bind it to the physical transport.
- Create a new test in Test Factory.
- Add an Iterate While loop to go through the complete queue of messages.
- Add a Subscribe action inside the loop and set the queue name and configure it for Browse mode.
- Tag the Message ID.
- Test the content of the message.
- Exit the Iterate While loop if the content is what is required; you have located the correct message.
- Use a Subscribe action with the Message ID in the Message Selector configuration to match the required message and remove it from the queue.
- You cannot use the RIT Subscribe action with the Filter settings. This method will find the right message but it will permanently remove all previous messages from the queue as it discards those that do not match the filter.
- The solution offered here may work with some other messaging systems if those systems support queue browsing and the use of message selectors.
- See the RIT documentation set for full details of creating and running tests, and for configuring connections to IBM MQ systems.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
RIT One MQ Message.zip
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.