AMQ Proton C++ Client - Best practice to handle message acknowledgements in a multithreaded environment
Issue
- I'm running into trouble trying to handle message acknowledgements in a multi threaded environment and was wondering what the best practices for doing so are.
- Using the sample code provided at: https://access.redhat.com/documentation/en-us/red_hat_amq/7.0/html-single/using_the_amq_cpp_client/index#acknowledging_received_messages
- As well as the examples provided at: https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/cpp/examples/multithreaded_client.cpp.html
- My issue stems from the proton::delivery object being available only in the on_message function. This implies that the message must be accepted in that function. Unfortunately this negates the ability to read several messages and process them prior to acknowledging them.
- Essentially what I'm doing with the AMQ C++ API and hoping to recreate with Proton is the following:
- Read messages off 1 or more queues.
- Place these messages into an internal work queue that is handled by a pool of threads.
- Acknowledge the messages only after they are processed to ensure nothing is lost.
Environment
- Red Hat AMQ 7
- Red Hat AMQ Clients
- 2.6.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.