Base publisher
Classes:
Name | Description |
---|---|
BasePublisher |
Abstract base class for event publishers. |
Classes¶
BasePublisher
¶
Bases: ABC
Abstract base class for event publishers.
This class defines the interface for publishing events. Subclasses should implement the publish, close, and sync_close methods to provide specific publishing logic.
Attributes:
Name | Type | Description |
---|---|---|
config |
Configuration dictionary for the publisher. |
Methods:
Name | Description |
---|---|
__init__ |
Initialize the publisher with the given configuration. |
close |
Close the publisher and release any resources. |
publish |
Publish an event. |
sync_close |
Close the publisher and release any resources (synchronous version). |
Source code in pyagenity/publisher/base_publisher.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
Attributes¶
Functions¶
__init__
¶
__init__(config)
Initialize the publisher with the given configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
dict[str, Any]
|
Configuration dictionary for the publisher. |
required |
Source code in pyagenity/publisher/base_publisher.py
17 18 19 20 21 22 23 |
|
close
abstractmethod
async
¶
close()
Close the publisher and release any resources.
This method should be overridden by subclasses to provide specific cleanup logic. It will be called externally.
Source code in pyagenity/publisher/base_publisher.py
37 38 39 40 41 42 43 44 |
|
publish
abstractmethod
async
¶
publish(event)
Publish an event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
EventModel
|
The event to publish. |
required |
Returns:
Type | Description |
---|---|
Any
|
The result of the publish operation. |
Source code in pyagenity/publisher/base_publisher.py
25 26 27 28 29 30 31 32 33 34 35 |
|
sync_close
abstractmethod
¶
sync_close()
Close the publisher and release any resources (synchronous version).
This method should be overridden by subclasses to provide specific cleanup logic. It will be called externally.
Source code in pyagenity/publisher/base_publisher.py
46 47 48 49 50 51 52 53 |
|