/*****************************************************************************/ /* */ /* (c) Copyright IBM Corp. 2006 All rights reserved. */ /* */ /* This sample program is owned by International Business Machines */ /* Corporation or one of its subsidiaries ("IBM") and is copyrighted */ /* and licensed, not sold. */ /* */ /* You may copy, modify, and distribute this sample program in any */ /* form without payment to IBM, for any purpose including developing, */ /* using, marketing or distributing programs that include or are */ /* derivative works of the sample program. */ /* */ /* The sample program is provided to you on an "AS IS" basis, without */ /* warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, */ /* EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* Some jurisdictions do not allow for the exclusion or limitation of */ /* implied warranties, so the above limitations or exclusions may not */ /* apply to you. IBM shall not be liable for any damages you suffer as */ /* a result of using, modifying or distributing the sample program or */ /* its derivatives. */ /* */ /*****************************************************************************/ /* */ /* Program name: backout */ /* */ /* Description: Sample java program that shows moving a poisoned message */ /* to the backout queue. */ /* */ /*****************************************************************************/ /* */ /* Function: */ /* */ /* This program will get a single message off of a queue enough times */ /* to exceed the backout threshold on the queue. It will then move the */ /* message to the backout queue specified for the queue. */ /* */ /* This program is run as follows: */ /* */ /* java backout -qm ... -q ... */ /* */ /* where */ /* -qm is the queue manager name */ /* -q is the queue name */ /* */ /* In order to run this program, a queue will need to be defined that has a */ /* a backout queue and backout threshold specified. In addition, an actual */ /* queue will need to be defined for the backout queue. This can be done */ /* using runmqsc with the following commands: */ /* */ /* define ql(ORIG.Q) boqname(ORIG.Q.BACKOUT) bothresh(5) */ /* define ql(ORIG.Q.BACKOUT) */ /* */ /* A message can then put put on the ORIG.Q. This backout program will then */ /* read the message 6 times and move it to ORIG.Q.BACKOUT. */ /* */ /* This program has been tested with WebSphere MQ v6.0.1.0 and JDK 1.5.0. */ /* */ /*****************************************************************************/ /* Note: This program requires SupportPac MS0B in order to be compiled and */ /* executed. You will also need to add the appropriate jar file to */ /* your classpath (com.ibm.mq.pcf.jar). */ /*****************************************************************************/ import com.ibm.mq.*; // Include the WMQ package import com.ibm.mq.pcf.*; // Include the WMQ PCF package public class backout { private String myQmgr = ""; private String myQname; private MQQueueManager qMgr; private int[] selectors = { CMQC.MQIA_BACKOUT_THRESHOLD, CMQC.MQCA_BACKOUT_REQ_Q_NAME }; private int[] intAttrs = new int[1]; private byte[] charAttrs = new byte[MQC.MQ_Q_NAME_LENGTH]; private int boThresh; /***********************************************************************/ /* Start everything up .... */ /***********************************************************************/ public static void main (String args[]) { backout mySample = new backout(args); mySample.init(); mySample.start(); System.exit(0); } public backout(String args[]) { for (int i=0; i