Waiting for the administration reply in Java

This method is implemented in class examples.config.BasicAdministration. It is a simple wrapper for the MQeQueueManager API call waitForMessage(), that sets up a filter to select the required administration reply, and casts any message obtained to an administration message.

    /**
     	* Wait for message - waits for a message to 
		* arrive on the administration reply queue
     	* of the specified target queue manager. 
		* Will wait only for messages with the
     	* specified unique tag
     	* return message, or null if timed out
     	*/
    public static final MQeAdminMsg waitForRemoteAdminReply(
                    MQeQueueManager localQueueManager,
                    String remoteQueueManagerName,
                    String match) throws Exception {
        // construct a filter to ensure we only get the matching reply
        MQeFields filter = new MQeFields();
        filter.putArrayOfByte(MQe.Msg_CorrelID, match.getBytes());
        
        // now wait for the reply message
        MQeMsgObject reply = localQueueManager.waitForMessage(
            remoteQueueManagerName,
            MQe.Admin_Reply_Queue_Name,
            filter,
            null,
            0L,
            10000);          // wait for 10 seconds
        return (MQeAdminMsg)reply; 
    }
 


© IBM Corporation 2002, 2003. All Rights Reserved