When you get an exception, how do you clear it from the session? Do you need to create a new session?
Thanks, Adam On Mon, Jan 5, 2009 at 3:16 PM, Alan Conway <[email protected]> wrote: > Carl Trieloff wrote: >> >> Adam Chase wrote: >>> >>> Premature sending (sorry) (the tab key killed me) >>> >>> So I have a system where I have groups of messages that need to be >>> accumulated and then processed exclusively. I might get a message for >>> any group at any time. The space of possible groups is quite large, >>> but at any time I expect there will be a reasonable number of groups >>> active. >>> >>> My plan was: >>> >>> produce(group, job) >>> { >>> query_queue(group) //to see if it exists >>> if (exists) >>> send_message(group) >>> else >>> declare_queue(group, exclusive) >>> send_message(group) >>> send_message(queues_to_process, group) >>> >>> } >>> >>> consume() >>> { >>> queueName = queue.receive(queues_to_process) >>> queue.subscribe(queueName) >>> queue.receive(queueName) //to get a bunch of messages >>> >>> //later when the queue has been idle (for a while) >>> queue_delete(queueName) >>> >>> } >>> >>> Not sure if I've explained myself well here or not, but my question is >>> 1) Is there a better way to accomplish this sort of thing and 2) can >>> you think of a way around the race condition between queue_query and >>> queue_delete? Does the alternate_exchange setting help any? >>> >>> Thanks, >>> >>> Adam >>> >> >> Are you trying/wanting to make sure messages are not sent a queue that is >> going to be deleted? >> >> Carl. >> >> > > You can pass the if-empty and if-unused flags to queue.delete to avoid > deleting a non-empty or in-use (has consumers) queue respectively. If the > conditions for delete aren't all met you'll get an exception. > >
