The Python interface to the Hermes message broker.
Project description
pyhermes
The Python interface to the Hermes message broker.
Documentation
The full documentation is at https://pyhermes.readthedocs.org.
Installation
To install pyhermes, simply:
pip install pyhermes
Then use it in a project:
import pyhermes
Features
- TODO
Quickstart
Subscriber
To create handler for particular subscription topic decorate your function using subscribe decorator:
import pyhermes
@pyhermes.subscriber(topic='pl.allegro.pyhermes.sample-topic')
def handler(data):
# process data
This function will be called every time there is new message published to the selected topic.
Publisher
Use publish function to publish data to some topic in hermes:
import pyhermes
@pyhermes.publisher(topic='pl.allegro.pyhermes.sample-topic')
def my_complex_function(a, b, c):
result = a + b + c
publish(my_complex_function._topic, {'complex_result': result})
You could publish directly result of the function as well:
import pyhermes
@pyhermes.publisher(topic='pl.allegro.pyhermes.sample-topic', auto_publish_result=True)
def my_complex_function(a, b, c):
return {'complex_result': a + b + c}
Result of decorated function is automatically published to selected topic in hermes.
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements/test.txt
(myenv) $ python runtests.py
Credits
Tools used in rendering this package:
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyhermes-0.7.1.tar.gz.
File metadata
- Download URL: pyhermes-0.7.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a1ac14cde58424e87feb9822bb29717bbaaf7c7c745c282f28629f6614733c7
|
|
| MD5 |
c877bcd604b36407a4bd5c3bb72ec10e
|
|
| BLAKE2b-256 |
185aa0a18faf03818a9f4c18660ec3e18013c4baa542b13fb2822b94c6f230d9
|
File details
Details for the file pyhermes-0.7.1-py3-none-any.whl.
File metadata
- Download URL: pyhermes-0.7.1-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6ec1b15ac166f1f0a8835e8a3660c84800838e6ae7e21d79d5cb7c8c776a6f5
|
|
| MD5 |
e24ad6a80b3068c70ede6a6838d70af8
|
|
| BLAKE2b-256 |
1c41a4bd3a33dbeb19e966901632467b2de2bc42e3a9e6fe3e87ae5b735003c4
|