2

I am attempting to make an Apache Camel application that integrates with ActiveMQ over AMQP.

I have been working from the provided 'camel-example-spring-jms' project, which is over the standard TCP connection, but I have modified to use my standalone ActiveMQ 5.8 installation (rather than embedded), which I have working fine using TCP.

Active MQ Configuration (amqp on 5672)

<transportConnectors>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61610?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
</transportConnectors>

Within 'camel-server.xml' I have replaced the existing "jms" 'ActiveMQComponent' with a 'JmsComponent' that references an 'AMQConnectionFactory' upon which I specify my connection URL (tried both variations below).

amqp://guest:guest@localhost/test?brokerlist='tcp://localhost:5672'
amqp://guest:guest@/?brokerlist='tcp://localhost:5672'

<bean id="jmsConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
    <constructor-arg index="0"
        value="amqp://guest:guest@localhost/test?brokerlist='tcp://localhost:5672'" />
</bean>
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="useMessageIDAsCorrelationID" value="true" />
</bean>

The server appears to start fine with the configuration above, but when I add a route to the amqp queue in the 'ServerRoutes.java' I get an error on startup.

from("amqp:queue:numbers").to("multiplier");

The error in the Camel Server window is:

[nsumer[numbers]] INFO  AMQConnection - to broker at tcp://localhost:5672
org.apache.qpid.AMQException: Cannot connect to broker: connect() aborted [error code 200: reply success]

And the error in my ActiveMQ windows is:

org.apache.activemq.transport.amqp.AmqpProtocolException: Could not decode AMQP frame: hex: 414d51500101000a
Caused by: org.apache.qpid.proton.engine.TransportException: AMQP header mismatch value 1, expecting 0  

Any help is appreicated in diagnosing this issue.

Thanks.

John Dalton
  • 249
  • 5
  • 13

2 Answers2

2

Right, so after lots of reading I think that ActiveMQ is AMQP 1.0 implementation and I appear to be using libraries that are using AMQP 0.10.

John Dalton
  • 249
  • 5
  • 13
  • Hey John, so how did you rectify the issue? What was the Maven dependency that you updated in POM. I am using qpid client version 0.24 with artifact id qpid-amqp-1-0-client-jms, and qpid-client and facing the same issue. – Soham Nov 25 '13 at 16:17
  • Hey, Unfortunately I do not have access to the codebase at the moment. However you seem to be using the correct library for AMQP 1.0, ensure your factories etc are using versions that are from that library and not pulling in the older AMQP library entities. – John Dalton Nov 26 '13 at 17:31
0

I was able to get this to work by adding the following mvn dependencies:

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-amqp</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jms_1.1_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.qpid</groupId>
        <artifactId>qpid-amqp-1-0-client-jms</artifactId>
        <version>0.24</version>
    </dependency>
    <dependency>
        <groupId>org.apache.qpid</groupId>
        <artifactId>qpid-amqp-1-0-client</artifactId>
        <version>0.24</version>
    </dependency>

And using this connection factory:

<bean id="jmsConnectionFactory" class="org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl" factory-method="createFromURL">
<constructor-arg index="0" type="java.lang.String" value="amqp:///?brokerlist='tcp://localhost:5672''" />

knt
  • 46
  • 2