0

I'm working with the stomp protocol using the active mq implementation as stomp server/broker. I would like to have a message queue for a stomp client, that can be filled while the client is offline so that when the client connects from time to time it can fetch the massages that have been deposited while it was offline.

As I read, this can be achived with simple subscription or durable subscription. I decided for durable subscription. Is this the right way?

Then I was wondering wich messages and headers I should use on the client side. Actually I'm using the following

CONNECT

  • login:
  • passcode:
  • client-id: some_mac_adr

SUBSCRIBE

  • destination: /queue/some_mac_adr
  • receipt: receipt-msg
  • durable-subscriber-name: default

now waiting for messages

timeout -->

DISCONNECT

Is this message sequence correct? I'm furthermore not using the unsubscribe command. Is this correct as well?

user1392028
  • 11
  • 1
  • 3

1 Answers1

1

I decided for durable subscription. Is this the right way?

Queues are durable by default so you do not have to make the consumer durable explicitly.

Regarding the headers, as I said, since you do not need to make the consumer durable, you can avoid passing the durable-subscriber-name header. And, not sure if this was incidental, but you do not need to keep the queue name and client-id same.

BTW, which language you are using? STOMP implementations in different languages should take care of reasonable defaults so you do not need to worry about headers for CONNECT, SUBSCRIBE, etc.

I'm furthermore not using the unsubscribe command. Is this correct as well?

Again, unsubscribe() does not make much difference for the queues but it's cleaner to unsubscribe when the consumer is done with its job.

I hope that helps your case.

Buchi
  • 1,322
  • 4
  • 14
  • 33