Test mirror between a main and replica brokers with default options but source-mirror-address defined and check if
addresses and queues are (or are not) replicated after a main broker restart
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:
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
ensure the queue MY.MIRROR.Q is created on main broker after it starts:
$ 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 |
|MY.MIRROR.Q |MY.MIRROR.Q |1 |0 |1078 |0 |1078 |0 |ANYCAST |
|activemq.management.fe92efa1-55ef-4ee7-9068-1fa0ad469b0d|activemq.management.fe92efa1-55ef-4ee7-9068-1fa0ad469b0d|1 |0 |0 |0 |0 |0 |MULTICAST |
ensure the queue MY.MIRROR.Q is created on replica broker after it starts:
$ 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 |
|MY.MIRROR.Q |MY.MIRROR.Q |0 |0 |0 |0 |0 |0 |ANYCAST |
|activemq.management.ba1da8b4-34f8-490c-9bf4-b8759ac6ad6e|activemq.management.ba1da8b4-34f8-490c-9bf4-b8759ac6ad6e|1 |0 |0 |0 |0 |0 |MULTICAST |
ensure the MY.MIRROR.Q queue is durable and anycast on main broker:
$ curl -s -H "Origin:http://10.0.132.32:8161" http://admin:admin@10.0.134.16:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"MY.MIRROR.Q\",subcomponent=queues,routing-type=\"anycast\",queue=\"MY.MIRROR.Q\" |jq '.' |egrep -i '(RoutingType|"Durable")'
"RoutingType": "ANYCAST",
"Durable": true,
ensure the MY.MIRROR.Q queue is durable and anycast on replica broker:
curl -s -H "Origin:http://10.0.134.16:8161" http://admin:admin@10.0.134.16:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"MY.MIRROR.Q\",subcomponent=queues,routing-type=\"anycast\",queue=\"MY.MIRROR.Q\" |jq '.' |egrep -i '(RoutingType|"Durable")'
"RoutingType": "ANYCAST",
"Durable": true,
produce messages on a queue named TEST.Q1
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://TEST.Q1
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[TEST.Q1], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[TEST.Q1], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[TEST.Q1], thread=0 Elapsed time in second : 2 s
Producer ActiveMQQueue[TEST.Q1], thread=0 Elapsed time in milli second : 2497 milli seconds
ensure it is replicated to the replica broker:
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 |
|MY.MIRROR.Q |MY.MIRROR.Q |0 |0 |0 |0 |0 |0 |ANYCAST |
|TEST.Q1 |TEST.Q1 |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|activemq.management.8cc89d98-1866-4b9f-9d45-50166c7b6812|activemq.management.8cc89d98-1866-4b9f-9d45-50166c7b6812|1 |0 |0 |0 |0 |0 |MULTICAST |
stop replica broker to ensure it will not receive the replication. You should see a log message in main broker like that:
*******************************************************************************************************************************
Retrying Server AMQP Connection DRSite on 10.0.134.16:6700 retry 1 of -1
*******************************************************************************************************************************
produce messages on a new queue TEST.Q2:
$ main/bin/artemis producer --url tcp://10.0.132.32:61616 --destination queue://TEST.Q2
Connection brokerURL = tcp://10.0.132.32:61616
Producer ActiveMQQueue[TEST.Q2], thread=0 Started to calculate elapsed time ...
Producer ActiveMQQueue[TEST.Q2], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[TEST.Q2], thread=0 Elapsed time in second : 2 s
Producer ActiveMQQueue[TEST.Q2], thread=0 Elapsed time in milli second : 2261 milli seconds
check the messages on TEST.Q2 on main broker:
$ 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 |
|MY.MIRROR.Q |MY.MIRROR.Q |0 |1004 |5098 |0 |4094 |0 |ANYCAST |
|TEST.Q1 |TEST.Q1 |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|TEST.Q2 |TEST.Q2 |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|activemq.management.98207ebc-30c2-4708-9822-c1467db20adc|activemq.management.98207ebc-30c2-4708-9822-c1467db20adc|1 |0 |0 |0 |0 |0 |MULTICAST |
delete the TEST.Q1 queue and address on main broker:
$ main/bin/artemis queue delete --name TEST.Q1 --url tcp://10.0.132.32:61616
Connection brokerURL = tcp://10.0.132.32:61616
Queue TEST.Q1 deleted successfully.
$ main/bin/artemis address delete --name TEST.Q1 --url tcp://10.0.132.32:61616
Connection brokerURL = tcp://10.0.132.32:61616
Address TEST.Q1 deleted successfully.
stop the broker and start it again and check the messages on the queues:
$ 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 |
|MY.MIRROR.Q |MY.MIRROR.Q |0 |1037 |1037 |0 |0 |0 |ANYCAST |
|TEST.Q2 |TEST.Q2 |0 |1000 |1000 |0 |0 |0 |ANYCAST |
|activemq.management.cb31867f-da25-4007-b0e0-82043971a969|activemq.management.cb31867f-da25-4007-b0e0-82043971a969|1 |0 |0 |0 |0 |0 |MULTICAST |
start the replica broker and check if the TEST.Q1 is deleted on the replica and the TEST.Q2 is created:
$ 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 |
|MY.MIRROR.Q |MY.MIRROR.Q |0 |0 |0 |0 |0 |0 |ANYCAST |
|TEST.Q2 |TEST.Q2 |0 |0 |0 |0 |0 |0 |ANYCAST |
|activemq.management.b7301407-d87e-4bd7-b939-febebc02cde7|activemq.management.b7301407-d87e-4bd7-b939-febebc02cde7|1 |0 |0 |0 |0 |0 |MULTICAST |