On 08/11/2010 09:54 AM, Chris Howard wrote:
Hi,

I am having difficulty with sending a simple request/response between a
server written in C# and a client written in python. I have no such
problems when the client and server are both written in python. I am
using qpid 0.7 (built from the trunk approx. 3 weeks ago)

Here is the code for the C# server:

try
{
Connection connection = new Connection("localhost:5672");
connection.Open();
Session session = connection.CreateSession();
Receiver receiver = session.CreateReceiver("send ; {create: always,
delete: always}");

while (true)
{
Message request = receiver.Fetch(DurationConstants.FORVER);
Sender sender = session.CreateSender(request.ReplyTo);
Message response = new Message("pong");
sender.Send(response);
}
}
catch (System.Exception e)
{
Console.WriteLine(e.ToString());
}

And here is the code for the python client:

import qpid.messaging

connection = qpid.messaging.Connection('amqp://localhost:5672')
connection.open()
session = connection.session()
receiver = session.receiver('#reply ; {create: always, delete: always}')
sender = session.sender('send ; {create: always, delete: always}')
request = qpid.messaging.Message(content = 'ping', reply_to =
receiver.source)
sender.send(request)
response = receiver.fetch(10)
print response.content
connection.close()

I start the server, and then start the client. The server receives the
request from the client, but the call to CreateSender throws an
exception with the message:

"Exchange 9224f93b-8c4b-4675-bc04-61e721387140#reply does not exist"

This appears to me to be a bug in the python client in converting an address to an AMQP 0-10 reply-to struct. It is sending the reply-to as an exchange value:

{MessageProperties: reply-to={ReplyTo: exchange=95004e55-23c9-4c41-acd0-bde7c09a6096#reply; }; application-headers={}; }

As it represents a queue, I believe the name should be sent as the routing-key of the reply-to struct, with the exchange left empty to refer to the default (nameless exchange). Certainly this is what the c++ client expects.

Rafi, do you agree?

Furthermore, there is another exception thrown during program exit:

Unhandled Exception: System.AccessViolationException: Attempted to read
or write
protected memory. This is often an indication that other memory is corrupt.
at qpid.messaging.Message.{dtor}(Message* )
at qpid.messaging.Message.__delDtor(Message* , UInt32 )
at Org.Apache.Qpid.Messaging.Message.Cleanup()
at Org.Apache.Qpid.Messaging.Message.!Message()
at Org.Apache.Qpid.Messaging.Message.Dispose(Boolean )
at Org.Apache.Qpid.Messaging.Message.Finalize()

This is a different issue and looks on first glance like a bug in the .NET 'binding' for the c++ implementation of the messaging API.

Chuck, any thoughts on this?

Also, the output from the broker suggests that the queue /has /been
created:

2010-08-11 09:44:37 info Queue
"9224f93b-8c4b-4675-bc04-61e721387140#reply": Policy created:
type=reject; maxCount=0; maxSize=104857600
2010-08-11 09:44:37 error Execution exception: not-found: Exchange not
found: 9224f93b-8c4b-4675-bc04-61e721387140#reply
(..\..\qpid\cpp\src\qpid\broker\ExchangeRegistry.cpp:92)

Can anyone explain what I am doing wrong here? Or is this a bug?

It's a bug (perhaps two in fact!).

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to