Source code for bobocep.cep.engine.receiver.pubsub

# Copyright (c) 2019-2024 r3w0p
# The following code can be redistributed and/or
# modified under the terms of the MIT License.

"""
Receiver publish-subscribe classes.
"""

from abc import ABC, abstractmethod

from bobocep.cep.event import BoboEvent


[docs] class BoboReceiverSubscriber(ABC): """ A receiver subscriber interface. """
[docs] @abstractmethod def on_receiver_update(self, event: BoboEvent) -> None: """ :param event: A new BoboEvent instance processed by the receiver. """
[docs] class BoboReceiverPublisher(ABC): """ A receiver publisher interface. """
[docs] @abstractmethod def subscribe(self, subscriber: BoboReceiverSubscriber) -> None: """ :param subscriber: Subscriber to add to list. """