evbus app-merge components for kafka queues
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-kafka, you can do so by either installing from PyPI or from source.
Install from PyPI
pip install evbus-kafka
Install from source
# clone repo
git clone git@gitlab.com:vmware/idem/evbus-kafka.git
cd evbus-kafka
# Setup venv
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Usage
Configure pop-evbus for your app.
The connection portion of the kafka profile accepts any parameters that can be used in the AIOKafkaProducer class
credentials.yml
kafka:
default:
connection:
bootstrap_servers:
- localhost:9092
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 kafka implementation.
async def my_func(hub):
await hub.evbus.broker.put(
routing_key="channel", body={"message": "event content"}, profile="default"
)
Testing
A kafka server is necessary for running the tests. You can use your own kafka server, or you can use docker . Start a local kafka server:
docker run -p 2181:2181 -p 443:9092 -p 9092:9092 \ ✔ 14s idem-core
--env ADVERTISED_LISTENERS=PLAINTEXT://localhost:443,INTERNAL://localhost:9093 \
--env LISTENERS=PLAINTEXT://0.0.0.0:9092,INTERNAL://0.0.0.0:9093 \
--env SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,INTERNAL:PLAINTEXT \
--env INTER_BROKER=INTERNAL \
krisgeus/docker-kafka
Configure credentials for testing with a local rabbitmq server:
# credentials.yml
kafka:
test_development_evbus_kafka:
connection:
bootstrap_servers: localhost:9092
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.
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
Built Distribution
File details
Details for the file evbus-kafka-1.0.0.tar.gz
.
File metadata
- Download URL: evbus-kafka-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa5c112b4a5a83a10b62bea2fb2a90eb8bdddb33bdb58e2938cdb24259965a00 |
|
MD5 | cb0bc16c3b08108f6cefdc3402a32e06 |
|
BLAKE2b-256 | 8f682aea856a6410129d98b4e4e859bb4090226f354cd8750ccfb625699333a2 |
File details
Details for the file evbus_kafka-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: evbus_kafka-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f123c8135c7a252f910e6b3d209e02a7ee64316de6d270071bf3ed24f5c65a2a |
|
MD5 | 989d2766c5bc9922e5a90ea5d67bf356 |
|
BLAKE2b-256 | ee9ae0e49a92c7d6f25f67a4ca536cdf8f1c3702d0b30401d4ff8390497a114c |