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.A
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://QUEUES.A
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[QUEUES.A], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[QUEUES.A], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[QUEUES.A], thread=0 Elapsed time in second : 3 s
Producer ActiveMQQueue[QUEUES.A], thread=0 Elapsed time in milli second : 3224 milli seconds
produces 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 : 2799 milli seconds
produces messages on NOT.MATCH.QUEUES.B:
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://NOT.MATCH.QUEUES.B
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[NOT.MATCH.QUEUES.B], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[NOT.MATCH.QUEUES.B], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[NOT.MATCH.QUEUES.B], thread=0 Elapsed time in second : 2 s
Producer ActiveMQQueue[NOT.MATCH.QUEUES.B], thread=0 Elapsed time in milli second : 2611 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 |
|NOT.MATCH.QUEUES.B |NOT.MATCH.QUEUES.B |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|QUEUES.A |QUEUES.A |2 |0 |1000 |0 |1000 |0 |ANYCAST |
|QUEUES.B |QUEUES.B |2 |0 |1000 |0 |1000 |0 |ANYCAST |
|activemq.management.c18d75fd-8586-48b8-b37e-1ed4ca1b6952|activemq.management.c18d75fd-8586-48b8-b37e-1ed4ca1b6952|1 |0 |0 |0 |0 |0 |MULTICAST |
$ 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 |
|NOT.MATCH.QUEUES.B |NOT.MATCH.QUEUES.B |0 |0 |0 |0 |0 |0 |ANYCAST |
|QUEUES.A |QUEUES.A |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|QUEUES.B |QUEUES.B |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|activemq.management.47b2af0d-f576-4215-ab99-f954b01039ee|activemq.management.47b2af0d-f576-4215-ab99-f954b01039ee|1 |0 |0 |0 |0 |0 |MULTICAST |
As displayed above and as expected becuase of the address-match setting:
- messages produced on QUEUES.A were sent to replica broker and no messages remains on main broker
- messages produced on QUEUES.B were sent to replica broker and no messages remains on main broker
- messages produced on NOT.MATCH.QUEUES.B remained on main broker and were not sent to replica broker