【问题标题】:ActiveMQ dlqDeliveryFailureCause java.lang.Throwable: duplicate from store for queueActiveMQ dlqDeliveryFailureCause java.lang.Throwable:从存储复制队列
【发布时间】:2017-04-17 20:58:17
【问题描述】:

我有一个 ActiveMQ v5.14.1 的 3 个代理设置。该设置涉及一组复合目标,这些目标从另一个队列中提取消息副本。以下是其中一个代理的配置 -

    <broker xmlns="http://activemq.apache.org/schema/core"
            brokerName="brokerC"
            dataDirectory="${activemq.data}"
            schedulePeriodForDestinationPurge="10000"
            schedulerSupport="true">

    <destinationPolicy>
        <policyMap>
          <policyEntries>
            <policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000" >
               <deadLetterStrategy>
                  <sharedDeadLetterStrategy processExpired="false" />
               </deadLetterStrategy>

              <networkBridgeFilterFactory>
                <conditionalNetworkBridgeFilterFactory replayWhenNoConsumers="true"/>
              </networkBridgeFilterFactory>
            </policyEntry>
            <policyEntry topic=">" >
              <pendingMessageLimitStrategy>
                <constantPendingMessageLimitStrategy limit="1000"/>
              </pendingMessageLimitStrategy>
            </policyEntry>
          </policyEntries>
        </policyMap>
    </destinationPolicy>

    <!-- Added entry for network of brokers -->
    <networkConnectors>
      <networkConnector name="linkFromCToA"
                        uri="static:(tcp://xx.xxx.xx.xxx:61616)"
                        useVirtualDestSubs="true"/>

      <networkConnector name="linkFromCToB"
                        uri="static:(tcp://xx.xxx.xx.xxx:61616)"
                        useVirtualDestSubs="true"/>
    </networkConnectors>
    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>

    <persistenceAdapter>
        <kahaDB directory="${activemq.data}/kahadb"/>
    </persistenceAdapter>


      <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage percentOfJvmHeap="70" />
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="20 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="50 gb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>

    <transportConnectors>
        <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    </transportConnectors>

    <!-- destroy the spring context on shutdown to stop jetty -->
    <shutdownHooks>
        <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
    </shutdownHooks>

    <destinationInterceptors>
      <virtualDestinationInterceptor>
        <virtualDestinations>
          <compositeQueue name="Q.1" forwardOnly="false">
            <forwardTo>
              <queue physicalName="Q.2" />
            </forwardTo>
          </compositeQueue>
        </virtualDestinations>
      </virtualDestinationInterceptor>
    </destinationInterceptors>


</broker>

这些配置在所有 3 个代理上都是相似的(当然除了代理 url)。一段时间后,在所有 3 个经纪人的 dlq 上,我看到以下异常 -

java.lang.Throwable: duplicate from store for queue://Q.2

此异常位于 dlq 中消息的标头“dlqDeliveryFailureCause”中。我观察到在 1 个代理设置中,这个问题永远不会出现。仅当我设置了 2 个或更多代理网络时。

【问题讨论】:

    标签: apache activemq message-queue


    【解决方案1】:

    对于遇到此问题的任何人,请查看以下链接 ActiveMQ User discussion.

    两个建议 1. 在队列级别禁用审计和 2. 更改 messageTTL=2(因为我有 3 个代理)。

    【讨论】:

    • 两年后,您是否找到了这个问题的解释或解决方案?链接的讨论仍然没有定论。我与 5.14.1 和代理端的复合队列有相同的问题,它会引发相同的错误并将消息放入 DLQ。
    • @DoNuT 我现在不记得 100% 的事情了,但在某种程度上原因如下 - 在代理网络设置中,我们确定如果代理 C 有消费者并且消息从代理 A -> 代理B->Broker C 然后Broker B 将获得2 个相同消息的重复副本——1 个从Q.1 转发,另一个从Q.2 转发。本质上,我们通过迁移到主从配置解决了这种情况(更多是因为这更适合我们的用例)。如果您尝试确定哪些消息在代理之间跳跃(不应该跳跃),应该可以帮助您解决这个问题。
    • 感谢您这么快回来。遗憾的是,我的设置是单代理 AMQ,唯一特定的部分是转发(队列-> 队列和主题-> 队列)。就我而言,在将副本放入 DLQ 之前,我从生产者连接中看到了 EOFException,然后在几秒钟后出现 duplicate from store 错误。生产者正在使用 Openwire 并重新连接,我想这超出了这张票的范围,如果我从客户端/生产者端查看日志,也许我会得到更好的了解。
    • @DoNuT 也许这会有所帮助 - stackoverflow.com/a/39920227/2112865。查看您是否有未完全关闭的连接。假设是这种情况,您可能还会生成重复的副本。
    • 与 VPN 站点到站点连接断开一起发生,但由于它是意外断开,我无法保证 100% 可用性,可能与重新连接有关(总是大约 20 秒发生客户退出后)。
    猜你喜欢
    • 1970-01-01
    • 2016-11-13
    • 2012-06-13
    • 1970-01-01
    • 2012-08-17
    • 1970-01-01
    • 2017-01-03
    • 2020-12-12
    • 2014-08-08
    相关资源
    最近更新 更多