Py学习  »  MQ

ActiveMQ主题到队列,当使用camel路由时,消息在从主服务器切换到从服务器时会丢失?

user3112019 • 5 年前 • 656 次点击  

设置: 默认activemq.xml。在本地数据中心的3台服务器上,每台服务器一个ActiveMQ实例,在远程数据中心服务器上,每台服务器一个ActiveMQ实例。所有3+1实例都在运行,但每个数据中心在任何给定时刻只有一个ActiveMQ实例是主实例。来自所有数据中心的所有实例的消息对网络kahadb都是持久的,我们为每条消息配置了两次重试。

目标: 使数据中心之间的队列保持同步。

问题: 要测试远程服务器何时关闭,将保存/保留所有消息,直到远程服务器重新联机。我将向ActiveMQ主题发送三条消息。

驼峰路由配置为从主题中读取并推送到2个本地队列。

第二个camel路由被设置为从一个本地队列中读取,并将消息推送到远程activemq。

当远程服务器关闭(数据中心2关闭),并且我们从主ActiveMQ(通过停止服务)故障转移到从服务器时,3条消息中的1条会丢失到以太网。 这似乎是第一条发送到远程服务器的消息。就好像它的连接被拒绝了,或者什么东西,它永远消失了,甚至不进入DLQ?

驼色配置:

<bean id="local" class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL" value="tcp://localhost:12345"/>
  <property name="preserveMessageQos" value="true" />
</bean>

<bean id="remote" class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL" value="failover:(tcp://remotehost:54321)"/>
  <property name="preserveMessageQos" value="true" />
</bean>

<camelContext id="topicToQueueCamelContext" xmlns="http://camel.apache.org/schema/spring">
    <route id="topicToQueue">
        <from uri="local:topic:SomeTopic"/>
        <to uri="local:queue:SomeQueue"/>
        <to uri="local:queue:SomeQueue.Remote"/>
    </route>
</camelContext>

<camelContext id="queueToRemoteQueueCamelContext" xmlns="http://camel.apache.org/schema/spring">
    <route id="queueToRemoteQueue">
        <from uri="local:queue:SomeQueue.Remote"/>
        <to uri="remote:queue:SomeQueue"/>
    </route>
</camelContext>

尝试: 将远程camel路由设置为事务处理,并在brokerurl故障转移传输上设置trackmessages=true。

有人知道哪些activemq brokerurl、activemq xml或camel uri查询字符串参数可能丢失吗?或者有人知道如何解决或调试这个丢失的消息问题吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/30869
 
656 次点击  
文章 [ 1 ]  |  最新文章 5 年前
burki
Reply   •   1 楼
burki    5 年前

您需要配置 ActiveMQComponent consume messages transactional . 默认情况下,消息消耗为 交易的。这样你就获得了最好的性能,但是你也“接受”了丢失消息。