繁体   English   中英

骆驼AMQP交易问题(与Qpid客户端一起使用)

[英]Camel AMQP transactions issue (with Qpid client)

我正在尝试通过我创建的AMQP连接添加事务,该连接是为了从项目连接到外部AMQP代理(我无权访问)。

为了使用SSL连接到AMQP代理,我使用Qpid的ConnectionFactory实现: org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl

我正在与类似下面的内容:

  • URI:amqps:// xxxx:port?brokerlist ='ssl:// xxxx:port'

  • 主题:topic:// topicName

  • 信任库和密钥库

连接是使用Apache Camel(v2.14.1)路由初始化的,该路由使用在JMS之上构建的Camel AMQP组件,与Apache Camel的AMQP组件文档中所述的完全相同(可在此处找到: http:// camel.apache.org/amqp.html中的“使用主题”部分)。

当我在未启用事务的情况下使用AMQP组件时,它工作得非常好。

另一方面,如果我通过以下方式启用交易:

  • 提供一个事务管理器,它必须是org.springframework.transaction.PlatformTransactionManager接口的org.springframework.transaction.PlatformTransactionManager作为org.springframework.transaction.jta.JtaTransactionManager

  • 在Camel端点上设置transacted = true配置选项

  • 在Camel端点上设置cacheLevelName = CACHE_NONE ,以某种方式仅从主题中拾取一条消息,其他所有消息均丢失/忽略。

日志显示事务管理器已成功创建:

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

您能告诉我我在做什么错吗?

(我怀疑也许我要连接的经纪人不支持交易)

我已经设法解决了这个问题(对于很晚才回答的问题,我们深表歉意)。 我在这里找到了很多有用的知识: http : //tmielke.blogspot.ro/2012/03/camel-jms-with-transactions-lessons.html

不管使用哪个事务管理器(JmsTransactionManager,Atomikos等),我要做的就是在端点上设置选项cacheLevelName = CACHE_CONSUMER。

如果您需要其他信息,可以在我在此处发布的链接中找到所有内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM