Working versions in the app

* IBM AllClient version : 'com.ibm.mq:com.ibm.mq.allclient:9.1.1.0'
* org.springframework:spring-jms : 4.3.9.RELEASE
* javax.jms:javax.jms-api : 2.0.1

My requirement is that in case of the failure of a message processing due to say, consumer not being available (eg. DB is unavailable), the message remains in the queue or put back on the queue (if that is even possible). This is because the order of the messages is important, messages have to be consumed in the same order that they are received. The Java app is single-threaded.

I have tried the following

```java
@Override
public void onMessage(Message message)
{
   try{
      if(message instanceOf Textmessage)
      {
      }

      :

      : 
      throw new Exception("Test");// Just to test the retry
    }
    catch(Exception ex)
    {
            try
            {
                int temp = message.getIntProperty("JMSXDeliveryCount");
                throw new RuntimeException("Redlivery attempted ");
                // At this point, I am expecting JMS to put the message back into the queue.
                // But it is actually put into the Bakout queue.
            }
            catch(JMSException ef)
            {
                String temp = ef.getMessage();
            }

    }
}

```

I have set this in my spring.xml for the jmsContainer bean.

```xml
    <property name="sessionTransacted" value="true" />

```

What is wrong with the code above ?

And if putting the message back in the queue is not practical, how can one browse the message, process it and, if successful, pull the message (so it is consumed and no longer on the queue) ? Is this scenario supported in IBM provider for JMS?

The IBM MQ Local queue has `BOTHRESH(1)`.