简体   繁体   English

ActiveMQ Topic to Queue,当从Master切换到Slave时使用Camel路由消息丢失?

[英]ActiveMQ Topic to Queue, When using Camel route messages getting lost when switching from Master to Slave?

The setup: Default ActiveMQ.XML.设置:默认 ActiveMQ.XML。 One ActiveMQ instance per server on 3 Servers at Local data-center, One ActiveMQ instance at a remote data-center Server.本地数据中心的 3 台服务器上的每台服务器一个 ActiveMQ 实例,远程数据中心服务器上的一个 ActiveMQ 实例。 All 3 + 1 instances are running, but only one ActiveMQ instance is the master at any given moment per data-center.所有 3 + 1 实例都在运行,但在每个数据中心的任何给定时刻,只有一个 ActiveMQ 实例是主实例。 Messages from all instances at all data-centers are persistent to a network KahaDB, and we've configured two retries per message.来自所有数据中心的所有实例的消息持久保存到网络 KahaDB,我们为每个消息配置了两次重试。

The goal: To keep the queues synchronized between data-centers.目标:保持数据中心之间的队列同步。

The problem: To test when the remote server is down, that all messages will be saved/persisted until the remote server is back online.问题:要测试远程服务器何时关闭,所有消息都将被保存/保留,直到远程服务器重新联机。 I will send three messages to an ActiveMQ Topic.我将向 ActiveMQ 主题发送三个消息。

A camel route is configured to read from the topic and push to 2 local queues.骆驼路由被配置为从主题中读取并推送到 2 个本地队列。

A second camel route is setup to read from one of the local queues, and push the message to a remote ActiveMQ.设置第二个骆驼路由从本地队列之一读取,并将消息推送到远程 ActiveMQ。

When the remote server is off (data-center 2 is down), and we fail over from the Master ActiveMQ (by stopping the service) to a slave, 1 out of the 3 messages is lost to the ether.当远程服务器关闭(数据中心 2 关闭),并且我们从主 ActiveMQ(通过停止服务)故障转移到从服务器时,3 条消息中有 1 条会丢失到以太坊。 It seems to be the first message that's sent to the remote server.这似乎是发送到远程服务器的第一条消息。 As if it's getting a connection refused or something, and it disappears forever, not even going into the DLQ?好像它的连接被拒绝或什么的,它永远消失了,甚至没有进入 DLQ?

The camel configuration:骆驼配置:

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

Tried: Setting the remote camel routes as transacted, and setting trackMessages=true on the brokerURL Failover Transport.尝试:将远程骆驼路由设置为事务处理,并在 brokerURL 故障转移传输上设置 trackMessages=true。

Does anyone have any ideas on which ActiveMQ BrokerURL, ActiveMQ XML, or Camel URI Query String Parameters might be missing -- or any ideas on how to solve or debug this missing message problem?有没有人知道 ActiveMQ BrokerURL、ActiveMQ XML 或 Camel URI 查询字符串参数可能丢失的任何想法——或者关于如何解决或调试此丢失消息问题的任何想法?

You need to configure your ActiveMQComponent to consume messages transactional .您需要将ActiveMQComponent配置为使用事务性消息 By default message consumption is not transactional.默认情况下,消息消费不是事务性的。 That way you get the best performance, but you also "accept" to lose messages.这样您可以获得最佳性能,但您也“接受”丢失消息。

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

相关问题 从CXFRS到ActiveMQ队列的Apache骆驼路线问题 - Apache camel route from cxfrs to activemq queue issue 当 RabbitMQ 宕机时,避免骆驼向队列发送消息 - Avoid camel from sending messages to queue when RabbitMQ is down 当activemq连接丢失时,Spring Context关闭camel路由 - Spring Context shutting down camel routes when activemq connection is lost 邮件卡在activemq队列中 - Messages are getting stuck in activemq queue 使用Apache Camel Java DSL从activemq接收消息 - Receive messages from activemq using apache camel java DSL 使用 apache 骆驼时如何为 azure 服务总线主题消息添加自定义属性或标签/主题? - how to add custom properties or label/subject for azure servicebus topic messages when using apache camel? 使用重定向Spring-MVC时错误消息丢失 - Error messages getting lost when using redirect Spring-MVC 如何将Apache Camel路由到内存中的ActiveMQ JMS队列 - How to route Apache Camel to an in-memory ActiveMQ JMS queue 从Camel路由强制ActiveMQ上的套接字超时? - Enforce socket timeout on ActiveMQ from Camel route? 当订阅者失败或停止从使用 JMS 的 activeMQ 中的主题接收消息时,有没有办法自动重新订阅? - Is there a way to auto re-subscription when subscriber fail or stops receiving message from a topic in activeMQ using JMS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM