Declare response queue with specific name for Request/Response pattern in EasyNetQ

1k views Asked by At

When using the Request/Response messaging pattern within EasyNetQ I need to declare a private response queue (with a specific name) before sending the message on the request queue?

I presume the framework declares the response queue in the background but how can I give this response queue a specific name?

I don't see any information on this within the documentation at https://github.com/EasyNetQ/EasyNetQ/wiki/Request-Response

2

There are 2 answers

0
Wiebe Tijsma On BEST ANSWER

This is the default implementation of the naming conventions: https://github.com/EasyNetQ/EasyNetQ/blob/develop/Source/EasyNetQ/Conventions.cs

So perhaps you can try something like this:

bus.Advanced.Conventions.RpcReturnQueueNamingConvention = () => "MyReturnQueue";
0
deng jie On

In the lastest EasyNetQ ,bus.Advanced.Conventions.RpcReturnQueueNamingConvention is readonly, can't be set

Maybe you can set queue name when using the RPC method like

bus.Rpc.Respond<RequestMsg, RepsonseMsg>(request => {//...},x=>x.WithQueueName("your queue name"));

or

var msg = bus.Rpc.Request<RequestMsg, RepsonseMsg>(request, x => x.WithQueueName("your queue name"));