EventEmitter Utils
Functions¶
AsyncIOEventEmitter
¶
AsyncIOEventEmitter(event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> EventEmitter
Create an EventEmitter
instance configured with the AsyncIOProcessingService
.
PARAMETER | DESCRIPTION |
---|---|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
EventEmitter
|
An instance of |
Source code in pyventus/events/emitters/event_emitter_utils.py
CeleryEventEmitter
¶
CeleryEventEmitter(celery: Any, queue: str | None = None, event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> EventEmitter
Create an EventEmitter
instance configured with the CeleryProcessingService
.
PARAMETER | DESCRIPTION |
---|---|
celery
|
The Celery object used to enqueue and process event emissions.
TYPE:
|
queue
|
The name of the queue where the event emission will be enqueued. Defaults to None, which uses the task_default_queue from the Celery configuration.
TYPE:
|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
EventEmitter
|
An instance of |
Source code in pyventus/events/emitters/event_emitter_utils.py
ExecutorEventEmitter
¶
ExecutorEventEmitter(executor: Executor, event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> EventEmitter
Create an EventEmitter
instance configured with the ExecutorProcessingService
.
PARAMETER | DESCRIPTION |
---|---|
executor
|
The executor object used to handle the execution of event emissions.
TYPE:
|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
EventEmitter
|
An instance of |
Source code in pyventus/events/emitters/event_emitter_utils.py
ExecutorEventEmitterCtx
¶
ExecutorEventEmitterCtx(executor: Executor | None = None, event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> Generator[EventEmitter, None, None]
Context manager that creates an EventEmitter
instance configured with the ExecutorProcessingService
.
This context manager yields an EventEmitter
instance, which can be used within a with
statement.
Upon exiting the context, the processing service is properly shut down.
PARAMETER | DESCRIPTION |
---|---|
executor
|
The executor object used to handle the execution of event emissions. If
TYPE:
|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Generator[EventEmitter, None, None]
|
An instance of |
Source code in pyventus/events/emitters/event_emitter_utils.py
FastAPIEventEmitter
¶
FastAPIEventEmitter(event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> Callable[[Any], EventEmitter]
Create an EventEmitter
instance configured with the FastAPIProcessingService
.
This function is compatible with FastAPI's dependency injection system and should be
used with the Depends
method to automatically provide the BackgroundTasks
instance.
PARAMETER | DESCRIPTION |
---|---|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[Any], EventEmitter]
|
An instance of |
Source code in pyventus/events/emitters/event_emitter_utils.py
RedisEventEmitter
¶
RedisEventEmitter(queue: Any, options: dict[str, Any] | None = None, event_linker: type[EventLinker] = EventLinker, debug: bool | None = None) -> EventEmitter
Create an EventEmitter
instance configured with the RedisProcessingService
.
PARAMETER | DESCRIPTION |
---|---|
queue
|
The Redis queue object used to enqueue and process event emissions.
TYPE:
|
options
|
Additional options for the RQ package enqueueing method. Defaults to None (an empty dictionary).
TYPE:
|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding subscribers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
EventEmitter
|
An instance of |