arobson / rabbot

Deprecated: Please see https://github.com/Foo-Foo-MQ/foo-foo-mq
MIT License
277 stars 129 forks source link

Starting and stopping subscriptions #189

Open aconanlai opened 5 years ago

aconanlai commented 5 years ago

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?

zlintz commented 5 years ago

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

aconanlai commented 5 years ago

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.