question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manual acknowledgement for consumed messages?

See original GitHub issue

Hi guys, I have a non-trivial case, where I have a queue with multiple message types and a single consumer subscribed to this queue.

Additionally, I want to buffer messages (based on some business logic) and only acknowledge them, when I am sure that they are successfully processed.

Basically what I need is to disable the default ack behavior that acks the message once the onMessage handler finishes execution, and I want to send the ack manually, based on the business logic of my application.

I want to achieve something like this:

     var orderEvents = new List<IMessage<OrderEvent>>();
     var positionEvents = new List<IMessage<PositionEvent>>();

     bus.Advanced.Consume(queue, registration =>
            {
                registration
                    .Add<OrderEvent>((message, info) => orderEvents.Add(message))
                    .Add<PositionEvent>((message, info) => positionEvents.Add(message));
            });

     .... <Several Business Rules Later> ...

     // queue.Acknowledge doesn't exist, It's just for illustration.
     orderEvents.ForEach(orderEventMessage => 
                       queue.Acknowledge(orderEventMessage))

If someone can point me to an API that exists and can achieve this, and I somehow skipped it, or a workaround that I can use, that would be great.

Thanks in advance!

Regards.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
potebcommented, Aug 15, 2018

Reading the RabbitMQ confirm documentation (https://www.rabbitmq.com/confirms.html) you’ll see that all the acks/rejects are in the Received scope. I don’t see how this can be done if RabbitMQ doesn’t support manual ack outside the Received scope.

1reaction
kgrosvenorcommented, Dec 19, 2018

Did this ever get done. It is quite important when using RabbitMQ to be able conditionally ackknowledge messages or reject them or requeue etc, this would be a great addition and i would move to this library if it did this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manual message acknowledgment in Apache Kafka
As you know Kafka has a way to acknowledge the message whether it was consumed or read by the server. This process can...
Read more >
Consumer Acknowledgements and Publisher Confirms
Manual acknowledgement mode is typically used with a bounded channel prefetch which limits the number of outstanding ("in progress") deliveries on a channel....
Read more >
Manual Acknowledge (commit) kafka messages with ...
I'm using ReplyingKafkaTemplate.sendAndReceive() to send and receive a message correlated by correlation id. The use case have many topics on ...
Read more >
3. Reference
MANUAL - the message listener ( AcknowledgingMessageListener ) is responsible to acknowledge() the Acknowledgment ; after which, the same semantics as ...
Read more >
Acknowledgement - SmallRye Reactive Messaging
A message is acknowledged when its processing or reception has been successful. It allows the broker to move to the next message. How...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found