i don't think you can do that directly in AMQP, but how about this:

publish to a direct exchange using group ID as the key.
create a 'group ID' queue, and publish persistent messages to it, each
containing a group ID.
a consumer who doesn't have a group ID takes one message from that queue.
a consumer subscribes to the direct exchange using its group ID as the key.

my wording is a little loose; i hope the idea is clear.

you may need to configure the system with the various queues (for the
group IDs) ahead of time, or create them when new group IDs appear, to
prevent messages from being discarded if no one has subscribed with a
particular key.


On Fri, Dec 4, 2009 at 4:45 PM, luying pan <[email protected]> wrote:
> Hi,
>  I'm new to qpid ... enterprise messaging period actually. I'm trying to
> evaluate QPid vs. ActiveMQ for work.
>
> There's a particular use-case I'm interested in, which is to be able to
> publish a set of messages to a random consumer given that the messages are
> grouped together with some sort of id. I know ActiveMQ advertises this as a
> feature. However looking at AMQP, it seems that the protocol should be
> flexible enough to do something like this, but I'm having a hard time coming
> up with a solution.
>
> The two basic exchanges Direct and Pub/Sub don't really fit this model. I do
> want the first message associated with a particular groupid to be received
> by any available consumer. However once, that message has been received by a
> consumer, I want subsequent messages associated with the same groupid to be
> routed to that same consumer and not any other consumers.
>
> Basically the available consumers do not know about the groupids until they
> consume the first message with a groupid.
>
> Python example would be nice, but I'll take code examples in any language
> just to get a feeling of how things might work.
>
> Luying
>



-- 
mARK bLOORE <[email protected]>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to