activemq 代理网络消息不流动

activemq 代理网络消息不流动

activemq 5.12

代理配置的网络:hub、spoke1、spoke2

spoke1 与 hub 有双工 n/w 连接 spoke2 与 hub 有双工网络连接

我使用以下内容在 spoke1 上制作

bin/activemq production --brokerurl tcp://0.0.0.0:61616 --destinationqueue://producer-214 --messagecount 100 --message "hi there" 然后在 spoke2 上,我尝试使用消息

bin/activemq consumer --brokerUrl tcp://0.0.0.0:61616 --destinationqueue://producer-214 我可以看到 spoke1 上有 100 条消息排队,但是我的消费者没有看到任何消息,只是等待

INFO | 连接到 URL:tcp://0.0.0.0:61616(null:null)INFO | 使用队列://producer-214 INFO | 接收之间休眠 0 毫秒 INFO | 运行 1 个并行线程 INFO | consumer-1 等待直到 1000 条消息被消费我对 spoke1/2 的配置除了 brokername 之外其他都相同。以下是 spoke2 的配置:

http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd“>

文件:${activemq.conf}/credentials.properties元素用于配置ActiveMQ代理。-->

<destinationPolicy>
    <policyMap>
      <policyEntries>
        <policyEntry topic=">" >
            <!-- The constantPendingMessageLimitStrategy is used to prevent
                 slow topic consumers to block producers and affect other consumers
                 by limiting the number of messages that are retained
                 For more information, see:

                 http://activemq.apache.org/slow-consumer-handling.html

            -->
          <pendingMessageLimitStrategy>
            <constantPendingMessageLimitStrategy limit="1000"/>
          </pendingMessageLimitStrategy>
        </policyEntry>
      </policyEntries>
    </policyMap>
</destinationPolicy>

<networkConnectors>
    <networkConnector uri="static:(tcp://172.31.10.24:61616)?transport.useInactivityMonitor=false" duplex="true"/>
</networkConnectors>

<!--
    Configure message persistence for the broker. The default persistence
    mechanism is the KahaDB store (identified by the kahaDB tag).
    For more information, see:

    http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
    <kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>


  <!--
    The systemUsage controls the maximum amount of space the broker will
    use before disabling caching and/or slowing down producers. For more information, see:
    http://activemq.apache.org/producer-flow-control.html
  -->
  <systemUsage>
    <systemUsage>
        <memoryUsage>
            <memoryUsage percentOfJvmHeap="70" />
        </memoryUsage>
        <storeUsage>
            <storeUsage limit="100 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>

Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans>

任何帮助将不胜感激

问候

答案1

问题是,当我在 Metwork 连接器中将 networkTTL 设置为 2 时,我的 networkTTL 就设置为 1,然后就可以从 spoke2 读取消息

谢谢

相关内容