2009/1/6 Adam Chase <[email protected]>:

> 4) something else??  If I have the queue auto-delete, won't I lose
> messages if the consumer that is subscribed to that work queue
> crashes?  Put all the work in one queue and have consumers release
> messages that they aren't responsible for, group responsibility could
> be managed via another tool or some sort of algorithm where messages
> are broadcasted to consumers.

I would do this using message selectors. That would avoid a lot of
queue creation and deletion.

You could have two queues: one queue contains the "job descriptors"
that gives out the ids that you are going to select on. The other
queue (or indeed queues) would contain the messages with the id you
are going to select on.

A consumer works by reading a message (or messages) from the job
descriptor queue. This is done within a txn that is not committed so
that if the consumer crashes the message is automatically put back on
the queue. Having read the job(s), in another session the consumer can
start reading from the job queue, selecting on the job descriptor ids.

This way you can scale up the number of consumers quite simply and the
job descriptors will be spread between them.

RG

Reply via email to