qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Chase" <adam.cha...@gmail.com>
Subject Re: Queue creation/deletion
Date Wed, 31 Dec 2008 14:32:56 GMT
Yes.

consumer:

if (queue.pop() == false && lastReceived > timeout)
{
     delete(queue);
}

But between the pop and the delete, a message is added to the queue.
This is possible, right?

Adam


On Tue, Dec 30, 2008 at 9:58 PM, Carl Trieloff <cctrieloff@redhat.com> 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.
>
>
>
>

Mime
View raw message