Types

class DeliverySemantic(*values)[source]

Bases: IntEnum

AT_MOST_ONCE = 0
AT_LEAST_ONCE = 1
EXACTLY_ONCE = 2
class EventStatus(*values)[source]

Bases: IntEnum

PENDING = 0
SENT = 1
FAILED = 2
class EventDict[source]

Bases: TypedDict

type: str
uid: str
ts: str
payload: dict[str, str | int | bytes]
class Event(type, uid=<factory>, ts=<factory>, payload=<factory>)[source]

Bases: object

Event class

Parameters:
  • type (EventType) – type of the event

  • uid (uuid.UUID) – unique id of the event. Defaults to random uuid4

  • ts (str) – timestamp of the event. Defaults to current timestamp

  • payload (dict[str, EncodableT]) – payload of the event. Defaults to empty dict

type: str | StrEnum | IntEnum
uid: UUID
ts: str
payload: dict[str, str | int | bytes]
asdict()[source]

Custom asdict method for result to be encodable

Returns:

Dictionary representation of the event

Return type:

EventDict

classmethod fromdict(obj)[source]

Classmethod for event construction from encodable dictionary

Parameters:

obj (EventDict) – Dictionary representation of the event

Returns:

Event object

Return type:

Event

class PipelineItem(func, func_path, event, group='default', clones=1)[source]

Bases: object

Pipeline item class

Parameters:
  • func (ConsumerFunc) – consumer function

  • event (EventType) – event type

  • group (ConsumerGroup) – consumer group. Defaults to DEFAULT_CONSUMER_GROUP

  • clones (int) – number of clones. Defaults to 1

  • func_path (str)

func: Callable[[Event], Any]
func_path: str
event: str | StrEnum | IntEnum
group: str | StrEnum | IntEnum
clones: int
class Pipeline(uid=<factory>, items=<factory>)[source]

Bases: object

Pipeline class

Parameters:
  • uid (uuid.UUID) – unique id of the pipeline. Defaults to random uuid4

  • items (set[PipelineItem]) – set of pipeline items. Defaults to empty set

uid: UUID
items: set[PipelineItem]
class Worker(name, runner, clones=1, uid=<factory>)[source]

Bases: object

Worker class

Parameters:
  • name (str) – name of the worker

  • runner (Any) – runner for the worker

  • clones (int) – number of clones. Defaults to 1

  • uid (uuid.UUID) – unique id of the worker. Defaults to random uuid4

name: str
runner: Any
clones: int
uid: UUID