stomp-js / stompjs

Javascript and Typescript Stomp client for Web browsers and node.js apps
Apache License 2.0
738 stars 80 forks source link

Persistent queues when subscribing to an exchange #596

Closed RookieIndieDev closed 9 months ago

RookieIndieDev commented 9 months ago

RabbitMQ's STOMP and Web STOMP plugins support durable subscriptions but only the ID header is being set. How to set headers like auto-delete and durable. Is there a way to create a durable subscription with stompjs when subscribing to exchanges? Even if I managed to create a durable queue my client subscribe to, would it subscribe to the same queue when it has to reconnect?

kum-deepak commented 9 months ago

I guess you already know the requisite headers to set (if not, please check https://www.rabbitmq.com/stomp.html#d.dts). The library API allows setting headers during subscription - please refer to https://stomp-js.github.io/api-docs/latest/classes/Client.html#subscribe. You can set headers, including the id.

RookieIndieDev commented 9 months ago

Figured out a workaround, could not get it to work with StompJS, had to use PHP amqplib to create and bind durable queues for each consumer and bind them to the exchanges.