I'm faceing a problem with JBoss EAP 6 and WebSphere MQ. I've developed a message driven bean:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/VGT.EXTERN.IN"),
@ActivationConfigProperty(propertyName = "clientID", propertyValue = "VGT_BYSENDINGSYSTEMDISPATCHERMDB") })
@Pool(value = "BySendingSystemDispatcherMDB-pool")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class BySendingSystemDispatcherMDB implements javax.jms.MessageListener {
private Logger logger = Logger.getLogger(getClass());
@Inject
@Named
BySendingSystemDispatcher bySendingSystemDispatcher;
@Resource
MessageDrivenContext mdc;
@Inject
@Named
Listener listener;
@Override
public void onMessage(Message message) {
try {
// Weiterbearbeitung deligieren
bySendingSystemDispatcher.onMessage(message);
} catch (JMSException e) {
listener.handleExceptionWhenMessageIsPoisend(e);
logger.error(e.getLinkedException(), e);
mdc.setRollbackOnly();
} catch (JAXBException e) {
mdc.setRollbackOnly();
listener.handleExceptionWhileProcessingMessage(message, e);
logger.error(e.getMessage(), e);
} catch (ClassCastException e) {
logger.error(e.getMessage(), e);
mdc.setRollbackOnly();
} catch (Exception e) {
logger.error(e.getMessage(), e);
mdc.setRollbackOnly();
} finally {
// logging
if (logger.isDebugEnabled()) {
String id = null;
try {
id = message.getJMSMessageID();
logger.debug(((TextMessage) message).getText());
} catch (Exception e) {
logger.debug("logging of message - " + id + " failed");
}
}
}
}
The method bySendingSystemDispatcher.onMessage(message) is throwing an exception derived from java.lang.Exception, annotated with @ApplicationException(rollback=true). If this happens, the message will be redeliver 5 times, as configured and after that it loops within the ressource adapter and will not be delivered anymore. I've checked the same scenario with HornetQ and it works as expected.
The following exception will be thrown by MQ
Class : class javax.jms.JMSException
Stack : com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1611)
: com.ibm.msg.client.wmq.common.internal.messages.WMQSendMarshal.constructMQMD(WMQSendMarshal.java:287)
: com.ibm.msg.client.wmq.common.internal.messages.WMQSendMarshal.exportMQMDAndMessageBuffers(WMQSendMarshal.java:503)
: com.ibm.msg.client.wmq.common.internal.messages.WMQSendMarshal.exportMQMD(WMQSendMarshal.java:567)
: com.ibm.msg.client.wmq.internal.WMQPoison$PoisonMessage.calculateMqmdAndBuffers(WMQPoison.java:1816)
: com.ibm.msg.client.wmq.
One interesting point is, that you can find a backout count in the MQMD-header which exceeds the backout threshold.
Any idea what happens and how to be solved?
Jörg