pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
746 stars 144 forks source link

How to close response_queue and associated channel when RPC timeouts without response #401

Open zainvegeta opened 5 years ago

zainvegeta commented 5 years ago

Dear Sir, I have been using RawRabbit in a production application for performing RPC to a webservice on a remote PC.Sometimes the RPC client on the remote pc may loose its internet connection so the server will be creating response queues with a consumer which will never receive any response.The queue and channel created for this will stay there as there is consumer.So can you give me any options by which i can sort this out.

This is how i am performing RPC var result = await busClient.RequestAsync<InvocationRequest, InvocationResponse>(request, ctx => ctx .UseDedicatedResponseConsumer() .UseRequestConfiguration(cfg => cfg .PublishRequest(p => p .OnDeclaredExchange(e => e .WithName(Exchange) .WithAutoDelete()) .WithRoutingKey(RoutingKey) .WithProperties(prop => prop.DeliveryMode = 1)) .ConsumeResponse(r => r .Consume(c => c .WithRoutingKey($"responsekey{Guid.NewGuid()}")) .FromDeclaredQueue(q => q.WithName($"responsequeue{Guid.NewGuid()}")) .OnDeclaredExchange(e => e .WithName(Exchange) .WithAutoDelete()))));