Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to implement a consumer that also publishes messages #886

Closed
Bibek-Singh9 opened this issue Jul 2, 2020 · 3 comments
Closed

Unable to implement a consumer that also publishes messages #886

Bibek-Singh9 opened this issue Jul 2, 2020 · 3 comments

Comments

@Bibek-Singh9
Copy link

I am trying to implement a consumer that also publishes message.
Usage case-

  1. Created an Exchange "A" and bind a queue "A-queue" and produced a message.

  2. Created a consumer, consuming message from "A-queue" of Exchange "A".

  3. Within the consumer's handler, I am trying to publish/produce message to a new Exchange "B", It works for once or twice out of 100 times and fails with exception -
    The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=505, text='UNEXPECTED FROM - expected content body, got non content body frame instead', class Id=60, methodId=40
    note: But the same piece of code works till version - RabbitMQ.Client 5.2.0, in the later versions - 6.0.0 and above it causes this issue.

                   cons.Consume("A", async m =>
                     {
                         await Task.Delay(1000);
                         prod.Produce(channel: "Status", message: "Hello");
                        
                     });
                     // Each time the user enters a key that is not the escape key.
                     while (Console.ReadKey(true).Key != ConsoleKey.Escape)
                     {
                         // Produce to the channel and wait for the Consumer as defined above to pick up on the Produced.                         
                         for (int i = 0; i <= 10; i++)
                         {
                             prod.Produce(channel: "A", message: "Hello");
                         }
                     }
    

The produce and consume code is encapsulated in methods.
Stacktrace-
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.ModelRpc(MethodBase method, ContentHeaderBase header, Byte[] body)
at RabbitMQ.Client.Framing.Impl.Model._Private_ExchangeDeclare(String exchange, String type, Boolean passive, Boolean durable, Boolean autoDelete, Boolean internal, Boolean nowait, IDictionary2 arguments) at RabbitMQ.Client.Impl.ModelBase.ExchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, IDictionary2 arguments)
at RabbitMQ.Client.Impl.AutorecoveringModel.ExchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, IDictionary2 arguments) at RabbitMQ.Client.IModelExensions.ExchangeDeclare(IModel model, String exchange, String type, Boolean durable, Boolean autoDelete, IDictionary2 arguments)
at Bentley.Extensions.MessageBus.RabbitMQ.RabbitMQProducer.d__4.MoveNext() in D:\Projects\MessageBus\src\NetCore\Bentley.Extensions.MessageBus.RabbitMQ\RabbitMQProducer.cs:line 54

@michaelklishin
Copy link
Member

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. GitHub issues are not used for questions, investigations, root cause analysis, discussions of potential issues, etc (as defined by this team).

We get at least a dozen of questions through various venues every single day, often light on details.
At that rate GitHub issues can very quickly turn into a something impossible to navigate and make sense of even for our team. Because GitHub is a tool our team uses heavily nearly every day, the signal/noise ratio of issues is something we care about a lot.

Please post this to rabbitmq-users.

Thank you.

@michaelklishin
Copy link
Member

This kind of exception is solid evidence of incorrect frame interleaving on a shared channel. Without any specifics of your code the only suggestion we have is to use a separate channel for publishing. Consider putting together a repository that can be used to reproduce without guessing.

@michaelklishin
Copy link
Member

We have no evidence of this but #878 and #868 can be relevant here. @Bibek-Singh9 would you be able to give #878 a try with your exact workload (test)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants