I am using Artemis 2.6.2
with STOMP only and the following constellation:
Broker:
Server:
TaskResponse
without selector/filterTaskRequest
with header clientId = ID (the ID of the client what the server would request to)Client 123:
TaskRequest
with selector clientId = 123TaskResponse
with header clientId = 123When 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 address TaskResponse
and a multicast queue for this address with empty filter
Client 123 connect: Artemis
creates a multicast address TaskRequest
and a multicast queue for this address with filter clientId = 123
Message exchange: Messages are transfered from server to client and back to server as expected.
Client 123 disconnect: Artemis
removes the multicast address TaskRequest
and the coresponding multicast queue with filter clientId = 123
Server 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?
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.
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>
What you are observing is the expected behavior. If you send a message to an address with no queues (or in STOMP terms - a destination with no subscribers) then the message will have nowhere to go and will be discarded. This is normal pub/sub semantics.
If you want to preserve the messages even if no subscriber is present you can either: