Question

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.

Was it helpful?

Solution 2

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''" />

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top