rabbot
rabbot copied to clipboard
Starting and stopping subscriptions
I have read through the docs, and i understand that In general, Rabbot works best when queues exist for the lifetime of a service. Starting and stopping queue subscriptions is likely to produce unexpected behaviors (read: avoid it).
- however, my use case requires queues to be created dynamically and subscriptions to be created/remove dynamically - am I better off using amqplib
? For example, a simple test case:
- I create a queue, bind it to the exchange, then call
rabbot.startSubscription(queueName)
- Call
rabbot.stopSubscription(queueName)
- Call
rabbot.startSubscription(queueName)
The second startSubscription will never resolve, as it seems that the state is already subscribed? so the handlers in queueFsm.js
never get called.
Is my approach incorrect?
Can you provide more context around your use case of why you need to do that?
Can you provide more context around your use case of why you need to do that?
i have a horizontally scaled websocket server for clients to connect to. another service will send messages to a direct exchange, and these servers will have one queue for each user bound to the exchange. because these servers will be created/shutdown to meet changing load, and users can be shuffled between servers to rebalance them, i need to be able to start/stop subscriptions.