A Unified Microservice Communication Library
Project description
Connectiva
Connectiva: A Unified Microservice Communication Library
Overview
Connectiva is a powerful and flexible Python library designed to streamline communication across diverse microservices architectures. Whether you're using REST APIs, gRPC, Kafka, WebSockets, or traditional message brokers, Connectiva provides a unified interface to handle all your communication needs effortlessly.
Features
- Protocol Agnostic: Automatically detects and adapts to the communication protocol being used, whether it's REST, gRPC, Kafka, RabbitMQ, WebSockets, GraphQL, or file-based communication.
- Ease of Use: Leverages an intuitive, consistent API that allows you to connect, send, receive, and disconnect seamlessly across different communication methods.
- Extensibility: Built with modularity in mind, allowing developers to extend or customize communication strategies as needed.
- Efficiency: Utilizes efficient connection management and message handling to ensure robust performance in high-load environments.
Installation
Connectiva can be easily installed using Poetry, a dependency management tool for Python.
Using Poetry
To install Connectiva using Poetry, run the following command:
poetry add connectiva
Using pip
Alternatively, you can install Connectiva using pip:
pip install connectiva
Supported Protocols
Connectiva supports the following communication protocols:
- REST APIs
- gRPC
- Kafka
- RabbitMQ (and other message brokers)
- WebSockets
- GraphQL
- File-based communication
Usage
Here's a quick guide to using Connectiva in your Python projects:
1. Initialize Connectiva
from connectiva import Connectiva, Message
# Instantiate Connectiva with desired configuration
connectiva = Connectiva(
endpoint="kafka://localhost:9092",
broker_list="localhost:9092",
topic="my_topic",
group_id="my_group"
)
2. Connect to the Communication Endpoint
connectiva.connect()
3. Send a Message
message = Message(action="process", data="Hello, Kafka!")
response = connectiva.send(message)
print(f"Response: {response}")
4. Receive a Message
received_message = connectiva.receive()
print(f"Received: {received_message}")
5. Disconnect
connectiva.disconnect()
Configuration
Connectiva is designed to be flexible and can be configured to suit your needs. Here's an example configuration:
connectiva = Connectiva(
endpoint="grpc://localhost:50051",
topic="my_topic",
queue_name="my_queue",
)
Extending Connectiva
Connectiva is built with extensibility in mind. You can easily extend the library by adding new communication strategies or customizing existing ones. Simply create a new strategy class that implements the CommunicationMethod interface and add it to the strategy map.
Contributing
We welcome contributions to Connectiva! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a pull request on the main repository.
Please ensure that your code follows the project's style guidelines and includes appropriate tests.
License
Connectiva is released under the MIT License. See the LICENSE file for more details.
Authors
- Ali Tavallaie - a.tavallaie@gmail.com
Thank you for using Connectiva! We hope it simplifies your microservice communication needs.
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 connectiva-0.1.0.tar.gz.
File metadata
- Download URL: connectiva-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56788cb19e5f7fc750d1862d7678b7a8364bbab9e9300bdbd6dddf2d644f86ca
|
|
| MD5 |
87c4c4f2d60012c16b298c3b0465db02
|
|
| BLAKE2b-256 |
5172154725476061301e48f5fcc0ca0d9fad1bc159fc8b1d20c6b342bb0fffe9
|
File details
Details for the file connectiva-0.1.0-py3-none-any.whl.
File metadata
- Download URL: connectiva-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfdceb22da0b4d518f4a16b7213c1b5817c136e417be06cd486817252cd26bd1
|
|
| MD5 |
7f684487bb3de3d4c3266eb5f5478e99
|
|
| BLAKE2b-256 |
6a676ccce1f55156b5189de2d7a64f2bb56bcaaefffd70ffaa9d77a67545c9d3
|