If you are interested in contributing to this FAQ, please read the Contribution Guidelines.
Note: This web page lists various features of Open Message Queue that are not supported. Bugs filed against them will probably not be addressed. They are present in Open Message Queue for a number of reasons such as for debugging purposes, or for private use by another product. Use these APIs/features at your own risk.
Q: How do I list, query, delete or replace messages in a destination ?
A: You can either use a private Open Message Queue API and write your own application to do this or imqcmd. However, imqcmd cannot be used to replace messages in a destination. This API and the imqcmd enhancements can be used to inspect messages in queue or topic destinations.
A quick description of these operations:
- list - list messages in a destination
- query - query (i.e. obtain more detail) on a specific message in a destination
- delete - delete a specific message in a destination
- replace - replace a specific message in a destination with one you create. The old/new messages have to match types. Basically this is:
- delete old/existing message
- replace it with the new message you create
Open Message Queue API for listing/querying/deleting/replacing messages
You need to download the following items:
- zip file containing ant project: Mqmsgadmin.zip. The README file included in this zip file will describe how to run the sample applications in the ant project.
- (Optional) zip file containing HTML pages that describe the JMS based protocol between the Open Message Queue broker and administrative clients (imqcmd, imqadmin). This zip file is named adminprotocol.zip and is located under the File Archives section of the Open Message Queue website in the architecture/adminprotocol folder. Some of the files in Mqmsgadmin.zip refer to HTML files which are in this adminprotocol.zip file. At the time this document was written, a adminprotocol.zip file for Open Message Queue 4.2 was added to the website - the information relevant to message manipulation there should be compatible with Open Message Queue 4.1 as well.
The following commands can be used to quickly examine messages (eg what type they are or what properties they have) in a destination:
List all messages in queue 'TestQueue':
List all messages in queue 'TestQueue' starting at index 90 (Note - indices start at 0):
List 10 messages in queue 'TestQueue' starting at index 15:
Querying a message
Query a message in queue 'TestQueue' (Note - the message ID is placed in quotes to prevent any potential problems with the command shell):
Deleting a message
Delete a message in queue 'TestQueue' (Note - the message ID is placed in quotes to prevent any potential problems with the command shell):