Implementation of a message broker (Pubsub stands for publish and subscribe).
create_event_topic(interface_class: Type[T]) → T¶
Returns a proxy instance of the event interface, which the publisher can use to publish events. Behind the scenes every event invocation is serialized as EventRecord object and then routed to the registered subscribers.
interface_class – The class object of an abstract interface that defines the events as methods.
A proxy object, dynamically derived from the passed interface_class. This class is intended to be used by the publisher to trigger events.
interface_to_subscribers: Dict[Type[T], List[Subscriber]]¶
map of interface class to the list of subscribed receivers
notify_event(event: maze.core.events.event_record.EventRecord) → None¶
Notify about a new event. This is invoked by the EventService.
:param event The event to be added.
- Register a subscriber to receive events from certain published interfaces,
specified by Subscriber.get_interfaces()
new_subscriber – the subscriber to be registered