I believe youll need to either schedule work on the container thread, or use multiple threads and hand work off between them safely. Perhaps http://qpid.apache.org/releases/qpid-proton-0.30.0/proton/cpp/api/scheduled_send_8cpp-example.html or http://qpid.apache.org/releases/qpid-proton-0.30.0/proton/cpp/api/multithreaded_client_8cpp-example.html could be useful to look at.
Robbie On Thu, 19 Mar 2020 at 18:48, Francesco Raviglione <[email protected]> wrote: > > Dear all, > I am writing you because I'm trying to better understand how to use the > Qpid Proton C++ library, after learning a bit how to work with the C API. > > My goal would be, in particular, to write a client/producer which can > connect to an external broker, from which other clients can then consume my > messages. > > My issue is that I should integrate the client inside an application which > should continue running after I start the Qpid Proton event loop. > In particular, the application should perform other operations and prepare, > from time to time, the messages which should be dispatched to the broker. > > Do you know whether there is a good way to achieve this goal directly > within Qpid Proton? > > Looking at the "helloworld.cpp" example, the client is entering the event > loop by means of "proton::container(hw).run();", and exiting that loop only > when "d.connection().close();" is called. > Is there any way in which I can periodically "inject" some messages into > the event loop, letting the application run after the call to > "proton::container(hw).run();", and then going back to handling AMQP events > when I need to send a new packet, without the need of opening and closing > the connection every time (as the messages I need to prepare and send may > come quite at a fast rate, even less than every 100 ms)? > Should I rely on multiple threads? > > Thank you very much in advance for your assistance. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
