Event propagation to configured ingress plugins
Project description
An asynchronous message ingress system. evbus is an app-merge component for larger projects. Events are put on a broker queue. A listener watches the broker queue and propagates events to configured ingress queues.
INSTALLATION
Install from pypi
pip install pop-evbus
Install locally with testing libraries:
$ git clone git@gitlab.com:vmware/idem/evbus.git
$ pip install -e evbus -r evbus/requirements/test.in
Firing Events
There are two functions that will put an event into the broker queue; put and put_nowait The only difference between them is that put is asynchronous and put_nowait is synchronous. Both accept a routing_key, body, and profile.
routing_key
This option is forwarded to the ingress plugins’ publish functions. Some message queues take a routing_key option themselves, some need to open a channel on the message queue for the named routing_key. It’s up to the ingress plugins to implement this appropriately for the message queue they wrap.
body
The event body is serialized by the evbus broker when it is put on the broker Queue. The body can be any serializable object. The serializer can be configured by setting hub.serialize.PLUGIN to the name of the plugin that should be used.
profile
Configured profiles are formatted as follows:
provider:
profile_name:
profile_data:
The profile parameter for the broker put and put_nowait functions specifies which profile_name should be used for firing an event. If no profile is specified, the profiles called “default” will be used. There can be multiple providers with the same profile name, the event will be forwarded to all providers that have a matching profile name. A context (ctx) will be generated that will be sent to the appropriate ingress plugin’s publish function based on profile.
Full Example
Asynchronous put:
async def my_func(hub):
await hub.evbus.broker.put(
routing_key="channel", body={"message": "event content"}, profile="default"
)
Synchronous put:
def my_func(hub):
hub.evbus.broker.put_nowait(
routing_key="channel", body={"message": "event content"}, profile="default"
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pop-evbus-7.0.0.tar.gz
.
File metadata
- Download URL: pop-evbus-7.0.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.3 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df67fadad6da3913d022a0495b1f354612697d9889019d778a972e491623bf7f |
|
MD5 | 6a03dab1066e4678ef411e5c8a57ea6a |
|
BLAKE2b-256 | 19f1e1451657722e688a9345bc428e575f72f29adae04f85e49dd810e3dae2b2 |
File details
Details for the file pop_evbus-7.0.0-py3-none-any.whl
.
File metadata
- Download URL: pop_evbus-7.0.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.3 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148582c29d2397c6a2b21d6427b5c884d1b991b151805face7cd3de0f09c0ace |
|
MD5 | 4d5d0e438c4f94c28e93dd1d45dd0a15 |
|
BLAKE2b-256 | b00f193ec1ceafbc03b8c67d974d20f21f8cb586a99d26a7b815438746953ebd |