Library for inter-service event-based communication
Project description
Inter-service event communication
This library handles inter (micro)services communication in a decoupled way using the event/observer pattern.
The code raises an event when something happens and that event fires notifications to the registered listeners.
THIS IS A PYTHON 2.7 COMPATIBLE PACKAGE, FOR PYTHON 3 USE https://pypi.org/project/event-isc/
Implemented notifications are:
- Celery task
- HTTP request
YAML file configuration
Can be configured with a yaml file like this, passed as initialization argument or in environment variable EVENTISC_CONFIG
name_prefix: myapp.
listeners:
- kind: http
event_name: myapp.user_created
url: http://notification-service.mycompany.com/send-welcome/
requests_kwargs:
auth: ["myuser", "password"]
request_format: json
data:
user_id: "{event_data['user'].id}"
email: "{event_data['user'].email}"
- kind: celery
event_name_regex: myapp[.].*_created
queue: foo_service
task_name: foo_handle_created
task_kwargs:
event_name: {event_name}
event_data: {event_data}
Usage
import eventisc
...
eventisc.trigger("user_created", {"user": user}) # Should fire both listeners
eventisc.trigger("foo_created", {"foo": "bar"}) # Should fire only celery
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
event-isc-py2-0.0.2.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for event_isc_py2-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58c3ee58910c364d6075852913204fecb4590c2fc4d4ee75c813c08672a72a3e |
|
MD5 | 7341e48eb522c53252c1fe0f747d3459 |
|
BLAKE2b-256 | 36cd70c1360f5c1d2c34e2d20728b47de766c667b1a8c965f8f0ea4ed412c783 |