Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: best way to enable multiple-receiver queue?
Mark Harrison wrote:
> I have a cluster of CPUs generating thumbnails for
> a render farm. I would like to place thumbnail
> requests on a queue, and have the cluster of client
> dequeue the requests and process them.
>
> Of course, each request should be only dequeued once...
> if a thumbnail is being processed by one CPU, it
> shouldn't be processed by another CPU.
>
> Can AQS do this? Is it possible have the clients
> coordinate so that each message is dequeueed by only
> one client?
>
> If not, will several processes doing a SELECT FOR UPDATE
> followed by a DELETE be a reasonable approach for multiple
> consumers to exclusively process requests?
>
> TIA,
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios
I believe this is default mode of dequeuing in Streams AQ, so there's no extra work required to implement such queue. You will probably need to use FIRST_MESSAGE queue navigation option so that each consumer instance resets queue ordering and gets the first available message (those being already processed by other consumer instances will be skipped.) You may also want to override default FOREVER wait with NO_WAIT when dequeuing and handle ORA-25228 that will be raised on dequeue if no more messages are available, instead of allowing the consumer process to wait indefinitely with no way of terminating it more or less gracefully.
By default, dequeued messages are automatically deleted as soon as dequeuing process commits. This allows for restartable message processing: if consumer process fails to process a message for some reason, it can rollback current transaction and another process will be able to dequeue the message again, it will not be lost.
Regards,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Received on Wed Jan 03 2007 - 05:39:40 CST
![]() |
![]() |