Skip to main content

The Python interface to the Hermes message broker.

Project description

## pyhermes

[![Version Badge](https://badge.fury.io/py/pyhermes.png)](https://badge.fury.io/py/pyhermes.png)
[![Build Status](https://travis-ci.org/allegro/pyhermes.png?branch=master)](https://travis-ci.org/allegro/pyhermes)

The Python interface to the [Hermes](http://hermes.allegro.tech) message broker.

## Documentation

The full documentation is at https://pyhermes.readthedocs.org.

## Installation

To install pyhermes, simply:

```python
pip install pyhermes
```

Then use it in a project:

```python
import pyhermes
```

## Features

* TODO

## Quickstart

### Subscriber

To create handler for particular subscription topic decorate your function using `subscribe` decorator:

```python
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:

```python
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:

```python
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?

```python
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-test.txt
(myenv) $ python runtests.py
```

## Credits

Tools used in rendering this package:

* [Cookiecutter](https://github.com/audreyr/cookiecutter)
* [cookiecutter-djangopackage](https://github.com/pydanny/cookiecutter-djangopackage)



# History

## 0.1.3 (2016-06-21)

* Allow for custom wrapper around subcriber function
* Additional logging for event id and retry count
* Added support for Django <= 1.7
* Raw data is dumped only to debug logs.


## 0.1.2 (2016-04-20)

* New management command for testing Hermes connection


## 0.1.0 (2016-04-13)

* First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhermes-0.1.3.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

pyhermes-0.1.3-py2.py3-none-any.whl (12.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyhermes-0.1.3.tar.gz.

File metadata

  • Download URL: pyhermes-0.1.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyhermes-0.1.3.tar.gz
Algorithm Hash digest
SHA256 40556586079108a8dca79b693d355b62ff455077ba5ba0e35f1d545902438639
MD5 c6cc31559afe9b460f722499b2882b84
BLAKE2b-256 fd81357aa094b44fd8ac3fc2e331d09e48ec0a1ba01cc8d6f048e08ecfedd5c8

See more details on using hashes here.

Provenance

File details

Details for the file pyhermes-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyhermes-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e49c40a0cc102bbae498d66fac5413a48a9fc2c8ae9fe37b3f7deac5a138c4d4
MD5 a314641cdd7264620c1a401c10749ca0
BLAKE2b-256 933cdfbde5ec95c412c2db883b5f329dfcfd69653bf5cbc2a61bb61c88299040

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page