You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if there is some approach using this lib to check whether all messages published on the channel/connection were already sent out. In other words, if message queues are empty. And if we can await it.
Thanks
The text was updated successfully, but these errors were encountered:
publish() returns a promise which will resolve when the message is sent, so if you could do something like:
constpromises=[];promises.push(chan.publish(...));promises.push(chan.publish(...));promises.push(chan.publish(...));// Wait until all messages are sent, or one message has failedawaitPromise.all(promises);
Oh, I get that, I could describe context better. I wonder if that would be possible from the library side to expose its promises or some behavior that would expose it more like executor queue?
My scenario is that I could emit messages from different not interconnected places so it would be hard for me to capture all of msg promises. But I would have access to connection/channel.
Let's assume that the application is handling lots of "parallel" logic during which it publishes messages to the connection manager.
Then there comes a point in time that I decide that I am not expecting to send any more messages (or they are not relevant for me):
a) and the first time the manager queue is empty I would like to block on it or be notified (ofc it might never be empty, so I would block indefinitely or with some timeout?).
b) more advanced mechanism would be not allowing the new messages to be published to queue but I am still very much interested to send all that are still there without rejecting them
It is a little similar concept to ThreadExecutor in Java.
Personally, I am more interested with a) as I actually know that I won't block indefinitely in my scenario but probably something more versatile would be more useful.
Hi.
I wonder if there is some approach using this lib to check whether all messages published on the channel/connection were already sent out. In other words, if message queues are empty. And if we can await it.
Thanks
The text was updated successfully, but these errors were encountered: