Browse and Lock

Browsing a group of messages and locking them allows an application to assure that no other application is able to process the messages while they are locked. The messages remain locked until they are unlocked by the application. No other application can unlock the messages. The example program Example 5 contains an example of browsing messages with lock.

This command locks all the messages on the local queue SYSTEM.DEFAULT.QUEUE.NAME. These messages can now only be accessed by the application that locked them. (Any messages arriving on the queue after the Browse and Lock operation will not be locked).

The MQeMessageEnumeration object contains all the messages that match the filter supplied to the browse. .

An application can perform either a get or a delete operation on the messages to remove them from the queue. To do this, the application must supply the lock ID that is returned with the enumeration of messages. Specifying the lock ID allows applications to work with locked messages without having to unlock them first.

Instead of removing the messages from the queue, it is also possible just to unlock them, this makes them visible once again to all WebSphere MQ Everyplace applications. You can achieve this by using the unlockMessage() function.

Note:
See Getting and browsing messages from the WebSphere MQ-bridge queue for special considerations with WebSphere MQ-bridge queues.


© IBM Corporation 2000, 2003. All Rights Reserved