I am using Artemis 2.6.2
with STOMP only and the following constellation:
Broker:
- No queues configured in broker.xml, everything is auto created.
Server:
- SUBSCRIBE to destination
TaskResponse
without selector/filter - SEND to destination
TaskRequest
with header clientId = ID (the ID of the client what the server would request to)
Client 123:
- SUBSCRIBE to destination
TaskRequest
with selector clientId = 123 - SEND to destination
TaskResponse
with header clientId = 123
When I watch at the Artemis Console
the following happens:
No server and no client is connected: No address or queue is present
Server connect:
Artemis
creates a multicast addressTaskResponse
and a multicast queue for this address with empty filterClient 123 connect:
Artemis
creates a multicast addressTaskRequest
and a multicast queue for this address with filter clientId = 123Message exchange: Messages are transfered from server to client and back to server as expected.
Client 123 disconnect:
Artemis
removes the multicast addressTaskRequest
and the coresponding multicast queue with filter clientId = 123Server sends message to TaskRequest for client 123: According to
STOMP
client on server the message is sent successful. On the broker the message disappears.Same behavior vice versa: Client 123 is connected and server is not: According to
STOMP
client on client 123 the message is sent successful. On the broker the message disappears.
My guess is that the message is discarded because there is no route to a subscriber. If I enable the option "send-to-dla-on-no-route" in address-settings section of broker.xml the message goes directly to dead letter queue.
Do you know a way to preserve the messages until the subscriber reconnects?
Appendix 1: STOMP Messages
I am using the Stomp.Net Library with SelectorsCore Example but reduced only to selector s1. The workflow is a bit other than what I wrote above.
Unfortunately I did not found an example to enable logging of STOMP messages into a file in Artemis. Therefore I recorded the packets with WireShark, exported as text and uploaded into Gist StompMessages.txt. You can see there the diffrent STOMP messages, e.g. search for CONNECT, SEND, etc.
Solution
The solution was to use the option anycastPrefix=/queue/
in the acceptor
element in broker.xml
to force the queues to type ANYCAST
:
<acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;anycastPrefix=/queue/</acceptor>