Note that there are some explanatory texts on larger screens.

plurals
  1. POJMS on Websphere MQ and backout queue
    primarykey
    data
    text
    <p>I have MQ as an external JMS server on my Weblogic server. The thing is that I need to rollback the message and retry until backout threshold is reached. Then I need to move the message to backout queue.</p> <p>The MessageDrivenContext.setRollbackOnly() method takes care of that just fine. The problem, however, is with the message on the backout queue - it is uncommited.</p> <p>Moreover, the messages are being taken from backout queue and processed again as soon as new message appears on the main queue.</p> <p>This suggest me that there is something teribly wrong with my approach. I cannot, however, change the fact, that I have to retry the onMessage() with the same message a couple of times and send it to backout queue is backout threshold was reached.</p> <pre><code>@MessageDriven( name="MQListener", mappedName = "jms.mq.SOME.QUEUE.NAME", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms.mq.SOME.QUEUE.NAME"), @ActivationConfigProperty(propertyName = "connectionFactoryJndiName", propertyValue = "jms.mq.MQ"), @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true") }) public class MQListener implements MessageListener { @Resource private MessageDrivenContext context; @Override public void onMessage(Message message) { String messageContent=""; try { messageId = message.getJMSMessageID(); if (message != null) { messageContent = ((TextMessage)message).getText(); if(!doSomething(messageContent)){ // doSomething fails, I need to rollback the message and try again: context.setRollbackOnly(); } } } catch (Exception e) { throw new RuntimeException(); } } private boolean doSomething(String messageContent){ // ... } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload