pardahlman / RawRabbit

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

Bug: using the same globalMessageId in subsequent `ExecuteSequence` calls causes a queue 404 exception #366

Open videege opened 6 years ago

videege commented 6 years ago

When I execute code like this:

var guid = Guid.NewGuid();
var resultA = await _client.ExecuteSequence(p => p.PublishAsync(new Message(), guid).Complete<Response>()).Task;
var resultB = await _client.ExecuteSequence(p => p.PublishAsync(new Message(), guid).Complete<Response>()).Task;

I get an immediate error on the second ExecuteSequence call:

RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=404, text="NOT_FOUND - no queue 'response_APPSUFFIX_75745365-7e51-452d-94c9-53b5547fbfc3' in vhost '/'", classId=60, methodId=20, cause=
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.BasicConsume(String queue, Boolean autoAck, String consumerTag, Boolean noLocal, Boolean exclusive, IDictionary`2 arguments, IBasicConsumer consumer)
at RabbitMQ.Client.Impl.AutorecoveringModel.BasicConsume(String queue, Boolean autoAck, String consumerTag, Boolean noLocal, Boolean exclusive, IDictionary`2 arguments, IBasicConsumer consumer)
at RawRabbit.Consumer.ConsumerFactory.ConfigureConsume(IBasicConsumer consumer, ConsumeConfiguration cfg)
at RawRabbit.Pipe.Middleware.ConsumerConsumeMiddleware.BasicConsume(IBasicConsumer consumer, ConsumeConfiguration config)
at RawRabbit.Pipe.Middleware.ConsumerConsumeMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.ConsumerMessageHandlerMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.ConsumerCreationMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.ChannelCreationMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.QueueBindMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.ExchangeDeclareMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Pipe.Middleware.QueueDeclareMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.Operations.Subscribe.Middleware.SubscriptionConfigurationMiddleware.InvokeAsync(IPipeContext context, CancellationToken token)
at RawRabbit.BusClient.InvokeAsync(Action`1 pipeCfg, Action`1 contextCfg, CancellationToken token)
at RawRabbit.Operations.MessageSequence.StateMachine.MessageSequence.RawRabbit.Operations.MessageSequence.Configuration.Abstraction.IMessageSequenceBuilder.Complete[TMessage]()
at RawRabbit.Operations.MessageSequence.MessageSequenceExtension.ExecuteSequence[TCompleteType](IBusClient client, Func`2 cfg)

If I don't specify the Guid in the Publish() method, it works just fine. I suspect there is a problem with queue declaration and the auto-delete nature of the message sequence topology?

Is this intended behavior? I'm trying to specify the Guid so that I can properly track the flow of messages stemming from an original request (i.e., one Guid per HTTP request).

videege commented 6 years ago

Some more info: this is on 2.0.0-rc5 and the RMQ version is 3.7.6.