Analyzing the reply message

This method is implemented in class examples.config.BasicAdministration. It shows how you might analyze a reply message, and return a reply that indicates whether or not the action was successful. Any error messages are printed to the console.

   /**
      *  Reply true if the given administration 
    * reply message represents a successful
       * administration action.  Return false otherwise.  
    * A message indicating success
       * or failure will be printed to the console.
       * If the administration action was not successful 
    * then the reason will be printed
       * to the console
     */
    public static final boolean isSuccess(MQeAdminMsg reply) 
                                  throws Exception {
        boolean success = false;
        final int returnCode = reply.getRC();
        switch (returnCode) {
            case MQeAdminMsg.RC_Success:
                System.out.println("Admin succeeded");
                success = true;
                break;
            case MQeAdminMsg.RC_Fail:
                System.out.println("Admin failed, reason:
                            "+ reply.getReason());
                break;
            case MQeAdminMsg.RC_Mixed:
                System.out.println("Admin partially succeeded:\n"
                              +reply.getErrorFields());
                break;
        }
        return success;
    }

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.