# Copyright (c) 2019-2023 r3w0p
# The following code can be redistributed and/or
# modified under the terms of the MIT License.
"""
Producer publish-subscribe classes.
"""
from abc import ABC, abstractmethod
from bobocep.cep.event import BoboEventComplex
[docs]class BoboProducerSubscriber(ABC):
"""A producer subscriber interface."""
[docs] @abstractmethod
def on_producer_update(
self,
event: BoboEventComplex,
local: bool
) -> None:
"""
:param event: Complex event generated by Producer.
:param local: `True` if the complex event was generated using
a locally-completed run; `False` otherwise.
"""
[docs]class BoboProducerPublisher(ABC):
"""A producer publisher interface."""
[docs] @abstractmethod
def subscribe(self, subscriber: BoboProducerSubscriber):
"""
:param subscriber: Subscriber to add to list.
"""