Sebastiaan la Fleur created ARTEMIS-3357:
--------------------------------------------
Summary: Setting multicast: prefix explicitely when reconnecting a
durable AMQP client causes the queue to be renewed and all pending messages lost
Key: ARTEMIS-3357
URL: https://issues.apache.org/jira/browse/ARTEMIS-3357
Project: ActiveMQ Artemis
Issue Type: Bug
Components: AMQP
Affects Versions: 2.17.0
Reporter: Sebastiaan la Fleur
Hello!
This issue was created after a discussion on the
[[email protected]|mailto:[email protected]] mailing list.
Subject: 'Understanding of Artemis multicastPrefix in AMQP address prevents the
transfer of historical and pending messages of queue' in June 2021.
[http://mail-archives.apache.org/mod_mbox/activemq-users/202106.mbox/%3Cbf67a06968df4b04a141edf382c5fc81%40NWMLMBX1004.ns.wpol.nl%3E]
Currently you may tell Artemis to auto-create a durable queue with AMQP by
setting the source terminus to a durable value. This allows pending messages on
the queue to be retrieved by the receiver on a reconnect. However, if you set
the multicast: prefix explicitely and reconnect, the queue will be replaced by
a queue with a new ID and all pending messages are lost.
I have reproduced this issue both with the Artemis client binary and with an
AMQP python proton client.
Steps based on Artemis binary which shows behavior is limited to setting the
multicast prefix explicitely:
What I will show are 2 points: 1) The ALL command does not renew/overwrite the
existing, durable subscription queue. Pending messages are received. and 2)
The NEW does renew/overwrite the existing, durable subscription queue. Pending
messages are lost.
Both situations appear to not influence each other as the order in which the 2
tests are tried do not matter.
Startup every test:
# Configure the 'someUser' user with the amq role and password 'somePassword'
# Start Artemis 2.17.0 with the broker.xml from the link.
# Change directory to the Artemis binary.
# Login and open the management console at
[http://localhost:8161/console/artemis/artemisQueues?nid=root-org.apache.activemq.artemis-ARTEMIS]
in a browser (the Queues page) 4. Run this command in a separate terminal:
./artemis producer --user someUser --password somePassword --url
amqp://localhost:5672 --sleep 1000 --protocol amqp --destination topic://foobar
--verbose
Cleanup every test:
# Close terminals
# Close management console.
# Quit Artemis.
# Remove persistent files e.g. docker container & volume.
Test ALL:
# Run: ./artemis consumer --durable --protocol amqp --user someUser --password
somePassword --clientID artemisconsoleALL --destination topic://foobar --url
amqp://localhost:5672 --verbose 6. Note:
- Messages are now being received in the terminal.
- In the management console click reset and note that a queue is created with
the name 'artemisconsoleALL.Consumer foobar, thread=0'.
- The ID of the queue.
- The queue is multicast.
- The queue is durable.
# Quit the command with CTRL+C and wait a couple of seconds.
# Note that the messages on the queue is increasing in the management console.
# Run the command again to connect the receiver.
# Note that ALL pending messages are received. Note that the queue id in the
management console did NOT change. Note that the queue in the management
console now has 0 pending messages.
Test NEW:
# Run: ./artemis consumer --durable --protocol amqp --user someUser --password
somePassword --clientID artemisconsoleNEW --destination
topic://multicast:foobar --url amqp://localhost:5672 --verbose 6. Note:
- Messages are now being received in the terminal.
- In the management console click reset and note that a queue is created with
the name 'artemisconsoleNEW.Consumer multicast:foobar, thread=0'.
- The ID of the queue.
- The queue is multicast.
- The queue is durable.
# Quit the command with CTRL+C and wait a couple of seconds.
# Note that the messages on the queue is increasing in the management console.
# Run the command again to connect the receiver.
# Note that NO pending messages are received. Note that the queue id in the
management console did change. Note that the queue in the management console
now has 0 pending messages.
Conclusion: For 2 independent durable subscriptions adding the multicast:
prefix will remove the existing durable subscription and replace it with a new
one while not adding the multicast: prefix will only the receiver to reuse the
existing durable subscription.
Minimal broker.xml:
{code:xml}
Minimal broker.xml:
<?xml version='1.0'?>
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq
/schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<name>ARTEMIS</name>
<acceptors>
<acceptor
name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true;anycastPrefix=anycast:;multicastPrefix=multicast:;sslEnabled=false</acceptor>
</acceptors>
<security-settings>
<security-setting match="foobar">
<!-- * = own (sender+receiver) appname -->
<permission type="createNonDurableQueue" roles="amq"/>
<permission type="deleteNonDurableQueue" roles="amq"/>
<permission type="createDurableQueue" roles="amq"/>
<permission type="deleteDurableQueue" roles="amq"/>
<permission type="createAddress" roles="amq"/>
<permission type="deleteAddress" roles="amq"/>
<permission type="browse" roles="amq"/>
<permission type="consume" roles="amq"/>
<permission type="send" roles="amq"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="foobar">
<!-- * = sender appname -->
<max-size-bytes>100000000</max-size-bytes>
<page-size-bytes>10000000</page-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>false</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
<min-expiry-delay>60000</min-expiry-delay>
<max-expiry-delay>604800000</max-expiry-delay>
<default-queue-routing-type>MULTICAST</default-queue-routing-type>
<default-address-routing-type>MULTICAST</default-address-routing-type>
</address-setting>
</address-settings>
<addresses>
<address name="foobar">
<multicast>
</multicast>
</address>
</addresses>
</core>
</configuration>
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)