proxystore.stream.protocols¶
Stream interface protocols.
Publisher/Subscriber¶
The Publisher
and
Subscriber
are
Protocols
which define the publisher and subscriber
interfaces to a pub/sub-like message broker system.
In general, these protocols do not enforce any other implementation details besides the interface. For example, implementations could choose to support any producer-to-consumer configurations (e.g., 1:1, 1:N, N:N).
There are two variants of publisher/subscribers:
Event
: The lower-level variant that are responsible for publishing and retrievingEventBatch
types. These require more complexity to implement but can support finer optimization.Message
: The higher-level variant that publishes pre-serialized messages in the form of bytes-strings and receives messages on the subscriber side. These are simple to implement.
A set of shims to third-party message brokers are provided in
proxystore.stream.shims
.
Plugins¶
Additional protocols, such as the
Filter
, are plugins used by the
StreamProducer
and/or
StreamConsumer
that alter
their behavior.
Publisher
module-attribute
¶
Publisher = Union['EventPublisher', 'MessagePublisher']
Publisher union type.
Subscriber
module-attribute
¶
Subscriber = Union['EventSubscriber', 'MessageSubscriber']
Subscriber union type.
EventPublisher
¶
Bases: Protocol
Publisher interface to an event stream.
close
¶
send_events
¶
send_events(events: EventBatch) -> None
Publish event with optional data to the stream.
Parameters:
-
events
(EventBatch
) –Batch of events to publish.
EventSubscriber
¶
Bases: Protocol
Subscriber interface to an event stream.
The subscriber protocol is an iterable object which yields objects from the stream until the stream is closed.
close
¶
next_events
¶
next_events() -> EventBatch