from proton.reactor import Container, Handler
class Recurring(Handler):
def __init__(self, period):
self.period = period
def on_reactor_init(self, event):
self.container = event.reactor
self.container.schedule(self.period, self)
def on_timer_task(self, event):
print("Tick...")
self.container.schedule(self.period, self)
try:
container = Container(Recurring(1.0))
container.run()
except KeyboardInterrupt:
container.stop()
print()
Apache Qpid, Messaging built on AMQP; Copyright © 2015 The Apache Software Foundation; Licensed under the Apache License, Version 2.0; Apache Qpid, Qpid, Qpid Proton, Proton, Apache, the Apache feather logo, and the Apache Qpid project logo are trademarks of The Apache Software Foundation; All other marks mentioned may be trademarks or registered trademarks of their respective owners