2

I am trying to add transactions over an AMQP connection which I created for connecting to an external AMQP broker (which I do not have access to) from my project.

In order to connect to the AMQP broker with SSL I am using a ConnectionFactory implementation from Qpid: org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl.

I am connecting with something like below:

  • URI: amqps://x.x.x.x:port?brokerlist='ssl://x.x.x.x:port'

  • topic: topic://topicName

  • a truststore and a keystore

The connection is initialized from an Apache Camel (v2.14.1) route, with the Camel AMQP component which was built on top of JMS, exactly as stated in the AMQP Component documentation from Apache Camel (which can be found here: http://camel.apache.org/amqp.html in section "Using Topics").

The AMQP component works perfectly fine when I use it without transactions enabled.

If, on the other hand, I enable transactions by:

  • providing a transaction manager which has to be an implementation of the interface org.springframework.transaction.PlatformTransactionManager as org.springframework.transaction.jta.JtaTransactionManager

  • setting transacted=true configuration option on the Camel endpoint

  • setting cacheLevelName=CACHE_NONE on the Camel endpoint somehow only one messaged gets picked up from the topic, everything else is lost/ignored.

The logs show that the transaction manager is created successfully:

DEBUG org.apache.camel.util.IntrospectionSupport: Configured property: transactionManager on bean: org.apache.camel.component.jms.JmsConfiguration@5b05bf with value: org.springframework.transaction.jta.JtaTransactionManager@1d642e2

DEBUG org.apache.camel.util.IntrospectionSupport: Configured property: cacheLevelName on bean: org.apache.camel.component.jms.JmsConfiguration@5b05bf with value: CACHE_NONE

DEBUG org.apache.camel.util.IntrospectionSupport: Configured property: concurrentConsumers on bean: org.apache.camel.component.jms.JmsConfiguration@5b05bf with value: 1

DEBUG org.apache.camel.util.IntrospectionSupport: Configured property: transacted on bean: org.apache.camel.component.jms.JmsConfiguration@5b05bf with value: true

Would you please let me know what am I doing wrong?

(I suspect that maybe the broker I am connecting to does not support transactions)

florin
  • 21
  • 5
  • What broker and version are you connecting to? – RaGe Jun 26 '15 at 14:28
  • I am connecting to some Qpid broker, but I do not know for sure the version nor the type. I do not have access to it so I can't check, but I am waiting for answers to this question from the guys owning the broker. I will post here the exact broker type and its version when I get the response. – florin Jun 27 '15 at 22:18
  • The broker is: Redhat A-MQ version 6.1 – florin Aug 10 '15 at 12:44
  • @RaGe: Would you please advise? – florin Aug 12 '15 at 07:43
  • I just wanted to check that your broker supports transactions, which it does. BTW, shouldn't you be using a JMS transaction manager – RaGe Aug 12 '15 at 14:22
  • I have switched from Jta to JmsTransactionManager and tested with a local instance of the broker and it seems to work fine when consuming from a Queue. – florin Aug 13 '15 at 15:16
  • Remote broker still isn't working? – RaGe Aug 13 '15 at 15:45

1 Answers1

0

I have managed to fix this issue ( sorry for the very late post here with the answer ). I have found a lot of usefull knowledge here: http://tmielke.blogspot.ro/2012/03/camel-jms-with-transactions-lessons.html

It does not matter which transaction manager you use (JmsTransactionManager, Atomikos etc.), all I had to do is to set the option cacheLevelName=CACHE_CONSUMER on the endpoint.

If you need additional information, you will find everything in the link I posted here.

florin
  • 21
  • 5