Messaging Communication Layer for Microservices Architecture
Project description
Messaging Layer for Microservices
_ _ _ _
| (_) | | (_)
__| |_ ___ ___| | __ _ _ _ __ ___ ___ _ __
/ _` | / __|/ __| |/ _` | | '_ ` _ \ / _ \ '__|
| (_| | \__ \ (__| | (_| | | | | | | | __/ |
\__,_|_|___/\___|_|\__,_|_|_| |_| |_|\___|_|
This service is in his early age. DO NOT USE in production or if you want to, please be aware you are going to use a piece of code which probably will be changed or improved ( and not necessarily in this order) soon and very often. You have been warned! This service requires at least another service listening to a few KAFKA topics.
Service description
This service provides microservices with an universal communication layer based on KAFKA messages. It provides two kind of Producer. One based on KAFKA and the other one based on the Confluent KAFKA version.
Required ENV variables
- brokers=mybroker1:9093,mybroker2:9093,mybroker3:9093
- monitoring_topic=tcservicesmonitor
If you are using AVRO you must have
- schema_registry=https://my_avro_schema_registry:8081
How to use it
PLAIN TEXT connection
from messaging_middleware.avro_communication_layer.Producer import Producer
producer = Producer(bootstrap_servers="your broker list here",
schema_reqistry_url="your schema registry here",topic='mytopic')
producer.produce_message(
value={your json message here},
key={your key schema here}, callback=my_callback_function)
SSL configuration
in order to connect to brokers using the SSL protocol, we need to pass the following kwargs to consumers/producers configuration
from messaging_middleware.avro_communication_layer.Consumer import Consumer as AvroConsumer
from messaging_middleware.avro_communication_layer.Producer import Producer as AvroProducer
if __name__ == "__main__":
c = AvroConsumer(
bootstrap_servers="sslbroker:29080",
security_protocoll='ssl', consumer_topic='my-topic')
p = AvroProducer(
bootstrap_servers="sslbroker:29080",
security_protocoll='ssl', topic='my-topic')
Integrated Logging System
By default, the Logger is connected to the following ENV variables
- brokers=mybroker:202021,mybroker2:202019
- schema_registry="https://sksk:8081"
- monitoring_topic=tcservicesmonitor
from messaging_middleware.utils.logger import Logger
logger = Logger()
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
Hashes for microservices_messaging_layer-1.0.18.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a64e4e366352fca51d16656ce0a927ac86952ebff69c7ffb337182a219287c4a |
|
MD5 | 57c00d8d2f3a4933aad0b2e4b0922d0a |
|
BLAKE2b-256 | 76674461d62059b53f227eb5611a501d9bfd3838999769ffce04e00de1a22936 |
Hashes for microservices_messaging_layer-1.0.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61538ef90ed40832faebd538b9a5c9da6d3e2a52b93445b73d41a8bbaeb9ece8 |
|
MD5 | 86fb887c606505d479f5af2ab6b9278d |
|
BLAKE2b-256 | 272f04fe36d189463097bcb5526a6e1a2bbdffd90bfb3d3fc90476fd525dd134 |