app-merge component for pop-evbus
Project description
This project contains app-merge components for pop-evbus .
Getting Started
Prerequisites
Python 3.7+
git (if installing from source, or contributing to the project)
Installation
If wanting to use evbus-pika, you can do so by either installing from PyPI or from source.
Install from PyPI
pip install evbus-pika
Install from source
# clone repo
git clone git@gitlab.com:vmware/idem/evbus-pika.git
cd evbus-pika
# Setup venv
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
Configure pop-evbus for your app.
Create a pika profile
pika:
default:
connection:
host: localhost
port: 5672
login: guest
password: guest
routing_key:
Encrypt the credentials file and export the ACCT environment variables
$ pip install acct
$ export ACCT_KEY=$(acct encrypt credentials.yml)
$ export ACCT_FILE="$PWD/credentials.yml.fernet"
Now when you put a message on the evbus queue, it will be propagated to your configured pika implementation.
async def my_func(hub):
await hub.evbus.broker.put(body={"message": "event content"}, profile="default")
Testing
The rabbitmq-server binary needs to be installed via your package manager. Start a local rabbitmq-server with the default parameters:
sudo rabbitmq-server
Configure credentials for testing with a local rabbitmq server:
# credentials.yml
pika:
test_development_evbus_pika:
connection:
host: localhost
port: 5672
login: guest
password: guest
routing_key:
Encrypt the credentials file and export the ACCT environment variables
$ pip install acct
$ export ACCT_KEY=$(acct encrypt credentials.yml)
$ export ACCT_FILE="$PWD/credentials.yml.fernet"
Install testing requirements
$ pip install -r requirements/test.in
Run the tests with pytest: .. code-block:: bash
$ pytest tests
Roadmap
Reference the open issues for a list of proposed features (and known issues).
Acknowledgements
Img Shields for making repository badges easy.