1 Reply Latest reply on Aug 16, 2013 3:44 AM by jayvijayraj

    JBoss EAP 6 -  integration with Websphere MQ

    jayvijayraj

      Hi

       

      I would like to use the JBoss EAP 6 to deploy the MDB to fetch messages from Websphere MQ.

       

      Here are my configurations.

       

      @MessageDriven(activationConfig = {

         @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

         @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "EP_WS_ASYNC = 'ON'"),

         ...

         @ActivationConfigProperty(propertyName = "useDLQ", propertyValue = "false") })

         @ResourceAdapter("wmq.jmsra.rar")

        @TransactionManagement(TransactionManagementType.CONTAINER)

       

       

         @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

      public class AsyncWSEndpointMDBImpl implements MessageListener {

       

      @Resource

      private MessageDrivenContext mMDC;

       

      public void onMessage(Message msg) {

      ....

      }

       

      private void rollbackMessage(Exception e) {

        mMDC.setRollbackOnly();

        log.info("The message " + messageID + " initiates message Rollback procedure..");

      }

      }

       

      Here is my resource adapter configuration

       

      Resource-adapter

       

      <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                  <resource-adapters>

                      <resource-adapter>

                          <archive>

                              wmq.jmsra.rar

                          </archive>

                          <transaction-support>NoTransaction</transaction-support>

                          <connection-definitions>

                              <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/MqConnectionFactory" pool-name="MqConnectionFactoryPool">

                                  ....                           

                      </resource-adapter>

       

       

      When I am trying to rollback the message back to MQ when certain condition is fails, i could not do so as it fails complaining.

       

      Message : java.lang.IllegalStateException: JBAS014315: setRollbackOnly() not allowed without a transaction.

       

       

      What i understood that with

      @TransactionManagement(TransactionManagementType.CONTAINER) 

       

       

      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

       

       

        

      I should be able to use non-XA transaction for rollback the message to MQ. kind of standard EJB container transaction should be supported.

       

      Could someone know how to do so?  Am I missing any configuration here?

       

      Regards,

      Jay

       

       

      ay

        • 1. Re: JBoss EAP 6 -  integration with Websphere MQ
          jayvijayraj

          Hello,

           

          I am answering my own question here.

           

          Somehow the JBoss community have not realised the use of LocalTransaction with Websphere MQ Resource adapter.

           

          When you define the

          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

           

          It declares not to inject the Transaction manger when you deploy the MDB. So when you execute mMDC.setRollbackOnly() it throws the error message

          Message : java.lang.IllegalStateException: JBAS014315: setRollbackOnly() not allowed without a transaction.

           

          In order to enable the Transactions with MDB using Websphere MQ resource adapter, you have two options.

           

          1. Enable XA-transactions (by default Websphere MQ resource adapter supports XA-transactions when enabled.)

               How to enable XA transaction is described here: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Deploy_the_WebSphere_MQ_Resource_Adapter.html

           

          2. Enable non-XA transaction

           

          To do this, unpack wmq.jmsra.rar and edit META-INF/ra.xml. The tag  <transaction-support>XATransaction </transaction-support>  should be changed to read  <transaction-support>LocalTransaction </transaction-support>  and add the com.ibm.mqetclient.jar file into lib folder to archive and then archive should be repackaged.

           

          remove the @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) from MDB.

           

          Hope this article will help you to enable standard EJB transactions with Websphere MQ. I have tested it with EAP 6.0.1 and it works.

           

          Regards,

          Jay