[rabbitmq-discuss] Managing and unknown number of responses

Neil Bartlett njbartlett at gmail.com
Tue May 5 00:06:35 BST 2009


You cannot really know how many consumers there will be. You might
think you know, but some might crash or do something funky and as a
result you will get fewer responses than you expect. If you wait until
all the consumers respond, then you may wait forever for the last
couple of responses that never arrive.

What you're trying to do is reach consensus on the value of a binary
variable. That's very hard to do in in absolute terms, instead you
have to think about probability. And, yes, non-determinism too...
sorry! Rather than always waiting a fixed period of time, you could
assume the value is true once a certain number of consumers have
responded, but you would still need a timeout in case that level of
confidence cannot be not reached in a reasonable time.

Neil


On Mon, May 4, 2009 at 11:40 PM, Colin Z <theczintheroc2007 at gmail.com> wrote:
> This may be an issue with asynchronous or message-passing based programming
> in general...I hope someone can help out...
>
> Basically, I want to send out a query in the form of an AMQ message and
> receive back responses from an unknown and possibly large number of
> responders.
>
> As an example, let's say we're doing some game logic and we want to figure
> out if an action should succeed or not.
>
> My idea was to publish a message to a topic exchange with a routing key like
> "magic.success.<characterName>" and then collect all the responses from all
> the subscribed subsystems and use their responses to decide if the action
> succeeded or not. It's almost like a map-reduce I guess.
>
> It seems like I would either need to set a timeout after which I stop
> waiting for responses (seems wasteful and possibly non-deterministic if some
> logic takes unusually long to run)
>
> or I somehow need to know in advance how many consumers there are, OR I need
> to know how many queues my initial message got delivered to.
>
> Has anyone dealt with something like this before?
>
>
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>




More information about the rabbitmq-discuss mailing list