Apache Camel AMQP - ActiveMQ AMQP 标头不匹配值 1,预期为 0 [英] Apache Camel AMQP - ActiveMQ AMQP header mismatch value 1, expecting 0

查看:60
本文介绍了Apache Camel AMQP - ActiveMQ AMQP 标头不匹配值 1,预期为 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个通过 AMQP 与 ActiveMQ 集成的 Apache Camel 应用程序.

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

我一直在使用提供的camel-example-spring-jms"项目工作,该项目通过标准 TCP 连接,但我已修改为使用我的独立 ActiveMQ 5.8 安装(而不是嵌入),我使用 TCP 工作正常.

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.

活动 MQ 配置(5672 上的 amqp)

<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>

camel-server.xml"中,我已将现有的jms"ActiveMQComponent"替换为引用AMQConnectionFactory"的JmsComponent",在该AMQConnectionFactory"上我指定了我的连接 URL(都尝试了变体如下).

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>

服务器似乎可以通过上述配置正常启动,但是当我在ServerRoutes.java"中向 amqp 队列添加路由时,我在启动时遇到错误.

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");

Camel Server 窗口中的错误是:

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]

我的 ActiveMQ 窗口中的错误是:

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.

谢谢.

推荐答案

我能够通过添加以下 mvn 依赖项来使其工作:

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>

并使用此连接工厂:

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

这篇关于Apache Camel AMQP - ActiveMQ AMQP 标头不匹配值 1,预期为 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆