The Browser sample program
The Browser sample program reads and writes both the message descriptor and the message content fields of all the messages on a queue.
The sample program is written as a utility, not just to demonstrate a technique. See Features demonstrated in the sample programs on Multiplatforms for the names of these programs.
- The name of the source queue (required)
- The name of the queue manager (required)
- An optional parameter for properties (optional)
These programs also use an environment variable named MQSAMP_USER_ID which should be set to the user ID to be used for connection authentication. When this is set, the program prompts for a password to accompany that user ID.
amqsbcg myqueue qmanagernameamqsbcgc myqueue qmanagername
myqueue is the name of the queue on which the
messages are going to be browsed, and qmanagername is the queue
manager that owns myqueue. - Formatted message descriptor fields
- Message data (dumped in hex and, where possible, character format)
| Value | Behavior |
|---|---|
| 0 | Default behavior, as it was for IBM WebSphere® MQ 6. The properties that get delivered to the application depend on the PropertyControl queue attribute that the message is retrieved from. |
| 1 | A message handle is created and used with the MQGET. Properties of the message,
except those contained in the message descriptor (or extension) are displayed in a similar fashion
to the message descriptor. For example:
Or if no properties are available:
Numeric values are displayed using printf, string values are surrounding in single
quotation marks, and byte strings are surrounded with X and single quotation marks, as for the
message descriptor. |
| 2 | MQGMO_NO_PROPERTIES is specified, so that only message descriptor properties will be returned. |
| 3 | MQGMO_PROPERTIES_FORCE_MQRFH2 is specified, so that all properties are returned in the message data. |
| 4 | MQGMO_PROPERTIES_COMPATIBILITY is specified, so that all properties can be returned depending on whether an IBM WebSphere MQ 6 property is included, otherwise the properties are discarded. |
The program is restricted to printing the first 65535 characters of the message, and fails with
the reason truncated msg if a longer message is read.
For an example of the output from this utility, see Browsing queues.