Test sender and receiver with address-match
Main:
created a broker with command:
$ amq-broker-7.8.0/bin/artemis create main --user admin --password admin --allow-anonymous
added to the config an acceptor:
tcp://0.0.0.0:6700?autoStart=true;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true
add to the config the broker connection:
Replica:
created a broker with command:
$ artemis create --user admin --password admin --allow-anonymous ~/replica
added to the config an acceptor
tcp://0.0.0.0:6700?autoStart=true;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true
added to the config the broker connection:
added to the config the addresses:
produce messages on QUEUES.B
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://QUEUES.B
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[QUEUES.B], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[QUEUES.B], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[QUEUES.B], thread=0 Elapsed time in second : 2 s
Producer ActiveMQQueue[QUEUES.B], thread=0 Elapsed time in milli second : 2458 milli seconds
produces messages on QUEUES.C
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://QUEUES.C
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[QUEUES.C], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[QUEUES.C], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[QUEUES.C], thread=0 Elapsed time in second : 2 s
Producer ActiveMQQueue[QUEUES.C], thread=0 Elapsed time in milli second : 2462 milli seconds
Check the messages on queues in main and replica:
$ main/bin/artemis queue stat --url tcp://10.0.132.32:61616
Connection brokerURL = tcp://10.0.132.32:61616
|NAME |ADDRESS |CONSUMER_COUNT |MESSAGE_COUNT |MESSAGES_ADDED |DELIVERING_COUNT |MESSAGES_ACKED |SCHEDULED_COUNT |ROUTING_TYPE |
|DLQ |DLQ |0 |0 |0 |0 |0 |0 |ANYCAST |
|ExpiryQueue |ExpiryQueue |0 |0 |0 |0 |0 |0 |ANYCAST |
|QUEUES.B |QUEUES.B |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|QUEUES.C |QUEUES.C |2 |0 |2000 |0 |2000 |0 |ANYCAST |
|activemq.management.b347d9ef-8893-49cc-b21c-9c9ed7c7e70b|activemq.management.b347d9ef-8893-49cc-b21c-9c9ed7c7e70b|1 |0 |0 |0 |0 |0 |MULTICAST |
2020-12-07 13:01:12 ⌚ tbueno-rhel8-1 in ~
○ → main/bin/artemis queue stat --url tcp://10.0.134.16:61616
Connection brokerURL = tcp://10.0.134.16:61616
|NAME |ADDRESS |CONSUMER_COUNT |MESSAGE_COUNT |MESSAGES_ADDED |DELIVERING_COUNT |MESSAGES_ACKED |SCHEDULED_COUNT |ROUTING_TYPE |
|DLQ |DLQ |0 |0 |0 |0 |0 |0 |ANYCAST |
|ExpiryQueue |ExpiryQueue |0 |0 |0 |0 |0 |0 |ANYCAST |
|QUEUES.B |QUEUES.B |0 |0 |1000 |0 |1000 |0 |ANYCAST |
|QUEUES.C |QUEUES.C |0 |1000 |2000 |0 |1000 |0 |ANYCAST |
|activemq.management.fe610016-bbb7-42bd-bba6-f6f10f85cc36|activemq.management.fe610016-bbb7-42bd-bba6-f6f10f85cc36|1 |0 |0 |0 |0 |0 |MULTICAST |
As displayed above and as expected becuase of the address-match setting:
- messages produced on QUEUES.B were not sent to replica broker
- messages produced on QUEUES.C were sent to replica broker and no messages remains on main broker