[rabbitmq-discuss] C# Request Reply Question

Bryan Murphy bmurphy1976 at gmail.com
Fri Feb 11 18:32:12 GMT 2011


On Fri, Feb 11, 2011 at 9:18 AM, Adam Rosenberger
<adam.rosenberger1 at gmail.com> wrote:
> I created a simple request reply example by deriving from SimpleRpcServer and using SimpleRpcClient. Based on the pattern from the c# examples, I used the same queue name for both the client and server.
>
> This worked well; however, the website example in python uses a separate request and reply queue, which makes more sense to me. I looked at Subscription and a couple other classes in reflector but didn't find anything obvious.
>
> Can anyone provide any insight as to why the c# example uses the same queue on both sides as opposed to the python example in the getting started section?
>
> Thanks,
> Adam

I haven't looked at the samples in a long time, and you didn't provide
any of your code.  I find it odd that you would send a response using
the same queue name.  Usually you would send the response message back
to the sender directly using the sender's reply address.  This is the
code I use to respond to a sender:

// Get sender address
var replyAddress = PublicationAddress.Parse(request.BasicProperties.ReplyTo);

// Don't remember if this is necessary, but it was in my code
if (replyAddress == null)
  replyAddress = new PublicationAddress(
    ExchangeType.Direct, "", request.BasicProperties.ReplyTo);

// Reply to sender
model.BasicPublish(replyAddress, basicProperties, data);

Bryan


More information about the rabbitmq-discuss mailing list