Results 1 to 4 of 4

Thread: How use whith IBM MQ the MQQueueManager.backout() metod whith spring framework?

  1. #1
    Join Date
    Feb 2008
    Posts
    4

    Default How use whith IBM MQ the MQQueueManager.backout() metod whith spring framework?

    How use whith IBM MQ the MQQueueManager.backout() metod whith spring framework?

    I made it with code with ibm code.

    Code:
    MQGetMessageOptions gmo = new MQGetMessageOptions(); // Set
    			// get
    			// message
    			// options
    			gmo.options = MQC.MQGMO_WAIT
    					+ MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT + MQC.MQGMO_SYNCPOINT;
    			gmo.waitInterval = MQC.MQWI_UNLIMITED;			
    			
    			while (true) {
    				MQMessage myMessage = new MQMessage();
    				myMessage.clearMessage();
    				myMessage.correlationId = MQC.MQCI_NONE;
    				myMessage.messageId = MQC.MQMI_NONE;
    				
    				System.out.println("waiting for message ... ");
    				myQueue.get(myMessage, gmo);
    				System.out.println("Get message sucessfull... ");
    				
    				System.out.println("Message lenght = "+myMessage.getMessageLength());
    				
    				/** ********************************* */
    				/* Have we gotten to the threshold? */
    				/** ********************************* */
    				if (myMessage.backoutCount <= boThresh) {
    					System.out.println("BackoutCount: "
    							+ myMessage.backoutCount + " of " + boThresh);
    					qMgr.backout(); /* increase backout count by one */
    				}
    I necessary make the backout on IBM MQ queue when there are exception in code.
    Someone know how do it?

  2. #2
    Join Date
    Jul 2005
    Posts
    105

    Default

    If you can't do it with JMS, you probably can't do it with Spring.

  3. #3

    Default

    Cant you do this with JTA transactions? I believe when you trigger a rollback on a JMS transaction, it causes the underlying MQ manager to perform a backout on the message.

  4. #4
    Join Date
    Feb 2008
    Posts
    4

    Default

    I resolve using JMS Session and Rollback:

    Code:
    queueConnectionFactory = (QueueConnectionFactory) getJmsReceiver()
    					.getJmsTemplate().getConnectionFactory();
    
    			// create a Queue Connection
    			queueConnection = queueConnectionFactory.createQueueConnection();
    
    			// create a Queue Session
    			queueSession = queueConnection.createQueueSession(true,
    					Session.AUTO_ACKNOWLEDGE);
    
    			// create Queue with DefaultDestination()
    			Queue queue = (Queue) getJmsReceiver().getJmsTemplate()
    					.getDefaultDestination();
    
    			// create Queue Receiver
    			queueReceiver = queueSession.createReceiver(queue);
                                          // start the connection
    			queueConnection.start();
    
    queueSession.commit();
    
    ....
    
    or queueSession.rollback();
    by

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •