AMQ Proton C++ Client - Best practice to handle message acknowledgements in a multithreaded environment

Solution Verified - Updated -

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:
  1. Read messages off 1 or more queues.
  2. Place these messages into an internal work queue that is handled by a pool of threads.
  3. 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.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content