I have a question, I have implemented simple RPC (Request/Response) with EasyNetQ, and it works but I wonder after I respond I am leaving behind not so pretty queue for example
easynetq.response.b01688d1-35c8-4b66-b127-57cd6a155961
This RPC will be used maybe once per month on couple of services, so leaving it there will result of unreadable queue list.
My request method looks like :
public async Task Request<TRequest, TResponse>(TRequest request, Action<Task<TResponse>> onResponse)
where TRequest : class
where TResponse : class
{
try
{
Console.WriteLine("Publishing Request: {0}", request);
await this.bus.RequestAsync<TRequest, TResponse>(request).ContinueWith(onResponse);
}
catch (TaskCanceledException ex)
{
Console.WriteLine("Task Failed: {0}", ex);
}
catch (EasyNetQException ex)
{
Console.WriteLine("Publish Request Failed: {0}", ex);
}
}
And my respond:
public void Response<TRequest, TResponse>(Func<TRequest, Task<TResponse>> onResponse)
where TRequest : class
where TResponse : class
{
try
{
bus.RespondAsync(onResponse);
}
catch (EasyNetQException ex)
{
Console.WriteLine("Respond Failed: {0}", ex);
}
}
So my question is, is there a way do remove that queue?
For anyone intereded, best thing I could come up with is using .. well "using" like:
using (var publishChannel = Bus.CreateMessageBus())
So each time I need to make a request I am connecting to rabbitmq making request awaiting response and then dispose request connection, meanwhile I have other static connection that doing constant background work and those two does not collide.
But is this a good pattern, according to documentation it will suffice.
But I will experiment on it.