Message redistribution on ArtemisMQ 2.x does not work

感情迁移 提交于 2020-01-05 05:42:26

问题


I would like to enable message redistribution on my 2-nodes cluster with static hosts. But it does not seem to work.

1) I have 10 producers that write to the queue "MyTestQueue" on node 1 (but no consumers).
2) I have 1 consumer on node 2 (but no producers) that consumes messages from node 2.

I expect that node 1 will redistribute the messages to node 2 where the consumer exists, but it does not. The message count on node 1 is still equal the amount of messages that was sent to node 1.

I have the following configuration in my broker.xml that sets forward-when-no-consumers to false. I also have set redistribution-delay to a value of zero.

<jms xmlns="urn:activemq:jms">
    <queue name="MyTestQueue"/>
</jms>
...
<cluster-connections>
      <cluster-connection name="my-test-cluster">
           <address>jms</address>
           <connector-ref>server0-connector</connector-ref>
            <retry-interval>500</retry-interval>
            <use-duplicate-detection>true</use-duplicate-detection>
            <forward-when-no-consumers>false</forward-when-no-consumers>
            <message-load-balancing>ON_DEMAND</message-load-balancing>
            <max-hops>1</max-hops>
            <confirmation-window-size>1024</confirmation-window-size>
            <static-connectors>
                <connector-ref>server1-connector</connector-ref>
            </static-connectors>
        </cluster-connection>
    </cluster-connections>
    ...
    <address-settings>
         <address-setting match="#">
             <redelivery-delay>5000</redelivery-delay>
             <redelivery-delay-multiplier>3</redelivery-delay-multiplier>
             <max-redelivery-delay>10000</max-redelivery-delay>
             <max-delivery-attempts>10</max-delivery-attempts>
             <max-size-bytes>104857600</max-size-bytes>
             <page-size-bytes>10485760</page-size-bytes>
             <address-full-policy>PAGE</address-full-policy>
             <redistribution-delay>0</redistribution-delay>
        </address-setting>
    </address-settings>

How can I get the message redistribution to work?


回答1:


This might be related to a known issue. There is a situation on which the broker fails to load balance the messages if they don't contain the application properties field.

Could you, please, try with that?




回答2:


Couple of things...

  • What version of Artemis are you using? Have you tried reproducing this with version 2.2.0?
  • What kind of client are you using (e.g. JMS, AMQP, STOMP, etc.)?
  • Do you have a reproducible test-case (e.g. a modified version of one of the examples shipped with Artemis)?
  • The configuration element <forward-when-no-consumers> is not valid in Artemis (although it was in older versions of HornetQ).



回答3:


Remove the <address>jms</address> from cluster connection configuration - each cluster connection only applies to addresses that match the specified address. And make sure that you're using compatible client because messages from 1.x clients to 2.x cluster are lost when the are load balanced to nodes with matching consumers.

Here's official, working example of ActiveMQ Artemis configuration with symmetric cluster, on demand load balancing and message redistribution



来源:https://stackoverflow.com/questions/45698399/message-redistribution-on-artemismq-2-x-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!