index, queue" /> Searching for a particular message

 

Searching for a particular message

The MQGET call usually retrieves the first message from a queue. If you use the message and correlation identifiers (MsgId and CorrelId) in the message descriptor to specify a particular message, the queue manager has to search the queue until it finds that message. Using the MQGET call in this way affects the performance of your application because, to find a particular message, WebSphere MQ might have to scan the entire queue.

We can use the IndexType queue attribute to specify that you want the queue manager to maintain an index that can be used to increase the speed of MQGET operations on the queue. However, there is a small performance overhead for maintaining an index, so only generate one if you know that you will use it. We can choose to build an index of message identifiers or of correlation identifiers, or we can choose not to build an index for queues where messages are retrieved sequentially. Try to have many different key values, not many with the same value. For example Balance1, Balance2, and Balance3, not three with Balance. For shared queues, have the right IndexType as described in the WebSphere MQ Application Programming Reference manual.

To avoid affecting queue manager restart time by using indexed queues, use the QINDXBLD(NOWAIT) parameter in the CSQ6SYSP macro. This allows queue manager restart to complete without waiting for queue index building to complete.

For a full description of the IndexType attribute, see the WebSphere MQ Application Programming Reference manual.