Skip to content

Event

This module provides the core Aspyx event management framework .

AbstractEnvelopePipeline(envelope_handler=None)

Bases: EnvelopePipeline

abstract base-class for envelope pipelines

EventListener

Bases: Generic[T]

An EventListener listens to a single event.

on(event)

Callback when an event occurs.

Parameters:

Name Type Description Default
event T

the event

required

EventManager(provider, exception_manager=None)

Central class that manages sending and receiving/dispatching events.

create a new EventManager

Parameters:

Name Type Description Default
provider Provider

an EventManager.Provider

required

Envelope

Bases: ABC

Wrapper around an event while being received or sent.

get(key) abstractmethod

retrieve a header value

Parameters:

Name Type Description Default
key str

a key

required

Returns:

Name Type Description
str str

the value

get_body() abstractmethod

return the body as a str

Returns:

Name Type Description
str str

the body

set(key, value) abstractmethod

set a header value

Parameters:

Name Type Description Default
key str

a key

required
value str

the value

required

EnvelopePipeline

Bases: ABC

An interceptor for sending and receiving events

handle(envelope, event_listener_descriptor) abstractmethod

interceptor on the handling side Args: envelope: the envelope event_listener_descriptor: the listener descriptor

send(envelope, event_descriptor) abstractmethod

interceptor on the sending side Args: envelope: the envelope event_descriptor: the event descriptor

EventDescriptor(type)

Covers the meta-data of an event.

EventListenerDescriptor(type, event_type, name, group, per_process)

Covers the meta-data of an event listener.

Provider()

Bases: EnvelopePipeline

The bridge to a low-level queuing library.

send_event(event)

send an event.

Parameters:

Name Type Description Default
event Any

the event

required

envelope_pipeline()

decorates an envelope pipeline

event_listener(event, name='', group='', per_process=False)

decorates event listeners.

Parameters:

Name Type Description Default
event Type

the event type

required
name

the listener name

''
per_process

if True, listeners will process events on different processes

False

Returns:

stomp