1
votes

I've set up a simple Spring app, which connects to a running HornetQ instance and sends a series of messages to a predefined queue. The problem is that the client (simple websocket client coming with HornetQ) only receives messages if it's already subscribed to a queue. Is there a way to store messages in a STOMP queue and then read them on connect with a consumer?

I've looked through both HornetQ and Stomp documentation, but since i don't really know what i'm looking for i've found only "retain" header, which seems to be proprietary with ActiveMQ and only retains last message in topic.

1

1 Answers

0
votes

It seems HornetQ supports all the same headers as ActiveMQ, but doesn't mention it in the documentation. So, here's headers i had to specify:

destination:<my-queue>
id:<some-id>
durable:true //this enables durability
auto-delete:false //this ensures queue won't get deleted

Passed those headers to StompSession session.send() and it worked like a charm. No additional changes required on the consumer side.