observable

class NotificationProducer[source]

Bases: pyloggr.utils.observable.Observable

A NotificationProducer produces some notifications and sends them to RabbitMQ

notify_observers(d, routing_key=None)[source]
Parameters:
  • d (dict) – a message to send to observers
  • routing_key (str) – routing key for the message

Note

Tornado coroutine

class Observable[source]

Bases: object

An observable produces notifications and sends them to observers

notify_observers(d, routing_key=None)[source]

Notify observers that the observable has a message for them

Parameters:
  • d (dict) – message
  • routing_key – unused

Note

Tornado coroutine

register(observer)[source]

Subscribe an observe for future notifications

Parameters:observer (Observer) – object that implements the Observer interface
unregister(observer)[source]

Unsubscribe an observer

Parameters:observer (Observer) – object that implements the Observer interface
unregister_all()[source]

Unsubscribe all observers

class Observer[source]

Bases: object

Implemented by classes that should be observers