0

Problem Statement: In "JTA/XA" mode when messages are consumed from "Source-Q" using camel and after performing the business logic(successful processing without any error or exception) unable to send the response back to "Destination-Q".

Enabled "camel" logging but no "errors/exceptions" are found for the "Destination- end point".

Used Tech Stack:

  1. JBoss Wildfly 10 (on Windows)
  2. activemq-rar-5.11.0.redhat-630356.rar (latest as per https://maven.repository.redhat.com/ga/org/apache/activemq/activemq-rar/)
  3. camel-2.15.3
  4. Red Hat AMQ 7.2 (Linux). Used "artemis create" to create an instance with default configurations.

"Resource adaptor approach" is followed with JBoss Wildfly 10 to integrate with Red Hat MQ 7.2.

Snippets from JBoss Wildfly 10 - "standalone.xml" configurations are provided below:

<subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
            <resource-adapters>
                <resource-adapter id="activemq">
                    <archive>
                        activemq-rar-5.11.0.redhat-630356.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                    <config-property name="ServerUrl">
                        tcp://redhatamqhostname:61616?jms.redeliveryPolicy.maximumRedeliveries=2
                    </config-property>
                    <config-property name="UserName">
                        defaultUser
                    </config-property>
                    <config-property name="InitialRedeliveryDelay">
                        1000
                    </config-property>
                    <config-property name="Password">
                        defaultPassword
                    </config-property>
                    <connection-definitions>
                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/XAconnectionFactory" enabled="true" use-java-context="true" pool-name="ConnectionFactory">
                            <xa-pool>
                                <min-pool-size>1</min-pool-size>
                                <max-pool-size>20</max-pool-size>
                                <prefill>false</prefill>
                                <is-same-rm-override>false</is-same-rm-override>
                            </xa-pool>
                        </connection-definition>
                    </connection-definitions>
                </resource-adapter>
            </resource-adapters>
        </subsystem>

Snippets from "camel-context" configurations are provided below:

    <bean id="JBOSSRMQ" class="org.apache.camel.component.jms.JmsComponent">
                    <property name="configuration">
                        <bean class="org.apache.camel.component.jms.JmsConfiguration"> 
                                <property name="connectionFactory" ref="connectionFactory" />
                                <property name="transactionManager" ref="transactionManager" /> 
                                <property name="transacted" value="false" />
                                <property name="concurrentConsumers" value="1" />
                                <property name="deliveryPersistent" value="true" />
                                <property name="requestTimeout" value="10000" />
                                <property name="cacheLevelName"  value="CACHE_NONE" />
                        </bean>
                    </property>
                </bean> 
            <jee:jndi-lookup id="connectionFactory" jndi-name="java:/XAconnectionFactory"/>    
    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>

Any ideas/thoughts to make it work? Thanks in advance!

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Couple of questions... 1) What actually happens when the "response" is sent to the "Destination-Q"? 2) What does it mean for `transacted` to be set to `false` in the `JmsConfiguration`? 3) Why do you need XA since you're only using a single resource manager (i.e. the remote AMQ instance)? – Justin Bertram Nov 27 '18 at 20:27
  • Please find answers as requested: – Subhayu Nov 28 '18 at 03:48
  • Sorry..answers were not updated. Here are they.1) In camel level logs there were no errors observed for the "Destination.Q". Required camel logs can be shared if required. 2) transacted should be false if we are using JTA as per camel and Redhat documentation. 3) Since we are using two data source DB and Q's, if we get any exception we need to "Rollback" entire life cycle and message has to be redelivered from the original Q. JTA is available from the point we receive message from the source Q, persisting data in DB and sending response back to the destination Q.Thanks – Subhayu Nov 28 '18 at 05:39
  • Just to add on to my above comments, the same set of configurations (standalone, camel-context) works fine with "apache-activemq-5.13.4". Tried with "jms.rmIdFromConnectionId=true" but no luck yet (as per https://access.redhat.com/documentation/en-us/red_hat_jboss_a-mq/6.1/html-single/integrating_with_jboss_enterprise_application_platform/index) – Subhayu Nov 28 '18 at 07:43

0 Answers0