qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Bayard <gregory.bay...@gmail.com>
Subject Re: Sending a message to a custom QPID direct exchange from Python
Date Mon, 14 Feb 2011 21:45:27 GMT
Hi Gordon,

I was originally working with 0.6 and the double-quoting was a quick
attempt to find some problem with my exchange and queue specification.
 When I updated my addressing string for Qpid 0.8, I still get the
same result.  The message is picked up by topic listeners listening to
the masterserver.summary.queue' topic on the 'masterserver.direct'
exchange.  The string, as you specified, is now:

"masterserver.direct/masterserver.summary.queue; {create: always,
node: {type:topic, x-declare:{type:direct}}}"

Keep in mind this queue will essentially always have been created by
the C++ server which is essentially guaranteed to start before any
Python clients.  I just can't figure out anyway to get Python to send
messages to the 'masterserver.summary.queue' on the
'masterserver.direct' exchange.  However, I have no problem sending
messages to the 'amq.direct' direct exchange from Python.  This issue
seems to be limited to custom direct exchanges.  Any suggestions on
how I could get a message via the custom direct exchange created by
the C++ from Python to the C++ server's queue would be greatly
appreciated.

Thanks,
Greg

On Mon, Feb 14, 2011 at 12:53 PM, Gordon Sim <gsim@redhat.com> wrote:
> On 02/11/2011 04:37 PM, Gregory Bayard wrote:
>>
>> Hello,
>> I am using the Apache QPID 0.8 release.  I have a C++ QPID application
>> using the request/response model which I would like to build a Python
>> client for.  The C++ listens for a response on a queue called
>> 'masterserver.summary.queue' bound to a custom direct exchange it
>> declared, 'masterserver.direct'.  A C++ client can send requests
>> without difficulty, but the requests are not received by the server
>> went sent from Python.
>>
>> The order of operations for the C++ server is as follows:
>> 1. Instantiate a class derrived from MessageListener
>> 2. Create a Session and start a SubscriptionManager on it
>> 3. Declare direct exchange 'masterserver.direct'
>> 4. Declare a queue for the session, 'masterserver.summary.queue' as
>> exclusive with auto delete
>> 5. Bind the 'masterserver.direct' exchange to the
>> 'masterserver.summary.queue' with binding key
>> 'masterserver.summary.queue'
>> 6. Subscribe the SubscriptionManager to the queue
>>
>> The Python code I'm attempting to use to send a request follows:
>>
>> import qpid.messaging
>> connection = qpid.messaging.endpoints.Connection("brokerhost")
>> connection.open()
>> session = connection.session()
>> requestSender =
>> session.sender("'masterserver.direct'/'masterserver.summary.queue'")
>
> Is the double quoting intentional? Why not just:
>
>  session.sender("masterserver.direct/masterserver.summary.queue")
>
>> msg = qpid.messaging.message.Message(content="test")
>> requestSender.send(msg)
>>
>> The server doesn't receive the request, BUT if I start a C++ server
>> with a topic exchange it does receive the above request (which
>> surprised me since I don't think the broker can handle a direct and
>> topic exchange with the same name).
>>
>> When I attempt to specify the exchange type as direct as follows I get
>> an exception "error in options: node-properties: illegal key":
>>
>> requestSender =
>> session.sender("'masterserver.direct'/'masterserver.summary.queue';
>> {create:always, node-properties:{type:topic, x-properties: {type:
>> direct}}}")
>
> There is no longer a node-properties option. Was this code you originally
> wrote against 0.6? The addressing was changed for 0.8 (should now be more
> stable).
>
> To have the exchange created on demand you would do:
>
>  "masterserver.direct/masterserver.summary.queue; {create: always, node:
> {type:topic, x-declare:{type:direct}}}"
>
> However I wouldn't recommend that as it tends to only add to the confusion.
>
>> Any ideas on how to send my request to the specified queue on the
>> direct exchange from Python?
>>
>> Thanks,
>> Greg
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Mime
View raw message