Richard, If you look in the Python examples directory, you'll find an example called recurring_timer.py. This shows how you can set up a recurring timer that fires every 4 seconds. When the timer fires, you can send your 30 messages in a loop. I would recommend checking the available credit on the sender (sender.credit I think) and to not send any more messages than you have credit for.
You should never write an infinite loop, nor should you ever call a blocking "sleep" function. HTH -Ted On Thu, Mar 14, 2024 at 10:48 AM Richard Sylvain < sylvain.rich...@skyguide.ch> wrote: > Hi all. > I would like to know how to send messages in an infinite loop within the > same producer (link). Or at least the same connection. > > I would like to send 30 messages then sleep 4 seconds in loop. > > I am not specialist of event programming. Could you share a sample please. > > As in the QPID proton python example. > I start my proton container with a sender MessagingHandler. > I create my AMQP1.0 connection and my sender (link) on the on_start method. > Then I send all the messages in the on_sendable method. > > I observe that the events on_accepted or on_rejected are not called until > the on_sendable method is completed. > > So I don't know how to do an infinite loop! > > Thank you for helping me. >