Skip to main content

Python adapter for Kafka

Project description

NAAS-PYTHON-KAFKA

This is the Kafka adapter for Python: it allows you to easily connect Python services to Apache Kafka via Python.

The implementation is a wrapper around Confluent-Kafka-Python:

  • AVRO schema's and messages: both key's and values should have a schema. as explained here.
  • Kafka consumer and producer for the test-bed topics.
  • Management
    • Heartbeat (topic: system-heartbeat), so you know which clients are online. Each time the test-bed-adapter is executed, it starts a heartbeat process to notify the its activity to other clients.

Installation

You need to install Python 3+.

To run the examples you will need to install the dependencies specified on the file requirements.txt.

For that, run

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt # Or instead of `pip`, use `pip3`

from the project folder.

Examples and usage

  • url_producer: creates a message with 4 URLs to RSS feeds on the topic ('system_rss_urls')
  • rss_producer: listens to url messages ('system_rss_urls') and produces RSS messages ('system_rss_urls')
  • rss_consumer: listens to RSS messages ('system_rss_urls') and prints them to console.

Uploading to PyPi

  1. Ensure you have the necessary tools installed: Make sure you have setuptools and wheel installed. You can install them using pip:
pip install setuptools wheel
Build the distribution files: In the root directory of your project, run the following command to build the distribution files (wheel and source distribution):
  1. Build the distribution files: In the root directory of your project, run the following command to build the distribution files (wheel and source distribution):
python setup.py sdist bdist_wheel
This command will generate the distribution files inside the dist directory.

This command will generate the distribution files inside the dist directory.

  1. Register an account on PyPI: If you haven't done so already, create an account on PyPI and verify your email address.

  2. Install and configure twine: Install twine, a tool used to upload packages to PyPI, using pip:

pip install twine
Upload the package to PyPI: Use twine to upload the distribution files to PyPI:
  1. Upload the package to PyPI: Use twine to upload the distribution files to PyPI:
twine upload dist/*
This command will prompt you to enter your PyPI username and password. Once provided, twine will upload the distribution files to PyPI.

This command will prompt you to enter your PyPI username and password. Once provided, twine will upload the distribution files to PyPI.

  1. Verify the package on PyPI: Visit your package page on PyPI to ensure that the package has been successfully uploaded and published.

Remember to update the version number in your setup.py file for each new release to avoid conflicts.

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

osint-python-test-bed-adapter-2.3.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file osint-python-test-bed-adapter-2.3.0.tar.gz.

File metadata

File hashes

Hashes for osint-python-test-bed-adapter-2.3.0.tar.gz
Algorithm Hash digest
SHA256 78613bb834d3d055def13db8240033b5680e74e4300cc3cca36b6f88e268a44f
MD5 571e01a0fab10e35b6386b5239af507f
BLAKE2b-256 a4eafa98b67df5f63f35855ff1ff4715352814d829a13f2d74d3212f00795a90

See more details on using hashes here.

File details

Details for the file osint_python_test_bed_adapter-2.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for osint_python_test_bed_adapter-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 789b118713a4b65c2d368f179feb1d73a2c671169253f386e1fe2f60071e2b45
MD5 5a1c74faf447c26d8c258793c90c3988
BLAKE2b-256 d45f75837c01e86550d7577d1cef5b31928e2ec0fc1a7cb7b0df7ec2ad6c1fd5

See more details on using hashes here.

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