So I'm trying this approach...

I'm manually accepting the messages.  And I have COMPLETE_ON_ACCEPT.
It seems like the queue is able to be deleted even with the if_empty
flag sent when my listener has the last message but I haven't accepted
it yet.  Not sure if that's a bug or not.  If I check the unaccepted
set before trying the delete I think there's a race.  Could manually
acquiring messages help here?  What if I synchronize my
listener::receive method with my delete?

Also about flowControl:

If I set my SubscriptionManager settings to have a window of 1 message
credit and then a subscribe a bunch of queues to the same listener, is
there 1 message credit per subscription or 1 for the whole set?

Thanks,

Adam

On Mon, Jan 5, 2009 at 3:16 PM, Alan Conway <acon...@redhat.com> 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.
>
>

Reply via email to