Skip to main content

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(ssl=1) 
logger = Logger()  # no ssl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for microservices-messaging-layer, version 1.0.17
Filename, size File type Python version Upload date Hashes
Filename, size microservices_messaging_layer-1.0.17-py3-none-any.whl (11.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size microservices_messaging_layer-1.0.17.tar.gz (6.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page