rabbot icon indicating copy to clipboard operation
rabbot copied to clipboard

Starting and stopping subscriptions

Open aconanlai opened this issue 6 years ago • 2 comments

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:

  1. I create a queue, bind it to the exchange, then call rabbot.startSubscription(queueName)
  2. Call rabbot.stopSubscription(queueName)
  3. 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?

aconanlai avatar Feb 26 '19 22:02 aconanlai

Can you provide more context around your use case of why you need to do that?

zlintz avatar Feb 26 '19 22:02 zlintz

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.

aconanlai avatar Feb 26 '19 23:02 aconanlai