qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Sending a message to a custom QPID direct exchange from Python
Date Mon, 14 Feb 2011 17:53:19 GMT
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


Mime
View raw message