Decorating the queue manager in Java

This method is implemented in class examples.config.BasicAdministration. It performs the steps described above to address the administration message, request a reply, and add a unique marker to the message.

    /**
     	* This method performs standard processing that 
		* decorates an administration message
     	* so that we can handle it in a standard way.
     	* <p>This method: 
     	* <p> Sets the target queue manager 
	  	* (the queue maanger upon which 
     	* the administration action takes place.
     	* <p> Requests that a reply message is sent 
		* to the administration reply queue on
     	* the target queue manager.
     	* <p> Incorporates a unique key in the message 
		* that can be used to retrieve
     	* the reply for this message.  
		* The unique key is returned as a string, to be
    	* used by the routine extracting the reply.
     */
    public static final String decorateAdminMsg(MQeAdminMsg msg, 
                              String targetQMName) throws Exception {
 
        // set the target queue manager
        msg.setTargetQMgr(targetQMName);
 
        // indicate that we require a reply message
        msg.putInt(MQe.Msg_Style, MQe.Msg_Style_Request);
 
        // use default reply-to queue on the target queue manager.
        msg.putAscii(MQe.Msg_ReplyToQ, MQe.administration_Reply_Queue_Name);
        msg.putAscii(MQe.Msg_ReplyToQMgr, targetQMName);
 
        // create a unique tag that we can identify the reply with
        String match = "Msg" + System.currentTimeMillis();
        msg.putArrayOfByte(MQe.Msg_CorrelID, match.getBytes());
 
        return match;
    }
 


© IBM Corporation 2002, 2003. All Rights Reserved