qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: C# queue autodelete problem
Date Fri, 18 Sep 2009 09:06:48 GMT
On 09/17/2009 10:20 PM, Azim Fatehi wrote:
>
> Thanks for the tip, Gordon.
>
> After turning tracing on it seemed like the queues were being declared with
> the correct options and the session was detached properly. But comparing the
> traces to ones collected with a C++ program, we found that the C++ client
> library seems to implicitly do an executionSync() after queueDeclare() which
> the C# library doesn't do. After modifying the C# program to explicitly sync
> the session after calling queueDeclare(), everything works properly and the
> queues are cleaned up when the client terminates.

Thats peculiar, I can't think how the syncing could affect that. 
However, if its working for you at present, thats good to hear!

> Gordon Sim wrote:
>>
>> On 09/16/2009 12:15 AM, res wrote:
>>>
>>> Hi All,
>>> I'm having some trouble with queue auto-delete in the C# client. I have
>>> created a queue with Option.AUTO_DELETE set, but when my client
>>> terminates
>>> it doesn't delete the queue within the broker. Has anyone else run in to
>>> this? Doing basically the same thing in C++ works fine.
>>
>> Turn on logging for the broker (e.g. specify --log-enable
>> trace+:amqp_0_10 --log-to-file qpidd.log to qpidd) and then run the code
>> below against that.
>>
>> You should then see the queue declare request as seen by the broker in
>> the log and can check that the flags set are as expected, and also that
>> the session is detached and the client closed as expected.
>>
>>
>>> My code looks like this:
>>>
>>> Here is the code for subscription:
>>>          _client.connect(host, port, "test", "guest", "guest");
>>>          _clientSession = _client.createSession(50000);
>>>          prepareQueue(qpidQueue, routingKey, _clientSession, inputQueue);
>>>
>>>          private void prepareQueue(string queue, string routing_key,
>>> ClientSession session , InputQueue inputQueue)
>>>           {
>>>               // Create a unique queue name for this consumer by
>>> concatenating
>>>               // the queue name parameter with the Session ID.
>>>               string queueName = queue + ":" + CustomRegistrationID;
>>>               session.queueDeclare(queueName, Option.EXCLUSIVE,
>>> Option.AUTO_DELETE);
>>>
>>>               // Route messages to the new queue if they match the routing
>>> key.
>>>               session.exchangeBind(queueName, "amq.topic", routing_key);
>>>
>>>               // subscribe the listener to the queue
>>>               IMessageListener listener = new MessageListener(this,
>>> session,
>>> inputQueue);
>>>               session.attachMessageListener(listener, queueName);
>>>               session.messageSubscribe(queueName);
>>>               session.messageFlow(queueName, MessageCreditUnit.MESSAGE,
>>> -1);
>>>           }
>>>
>>> Here is the code for unsubscribe:
>>>           _clientSession.close();
>>>           _client.close();
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>
>>
>>
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message