Giter Club home page Giter Club logo

python-mock-kafka-producer's Introduction

python_mock_kafka_producer

How to use

#FIRSTLY CREATE A VIRTUAL ENV AFTER CLONING THE PROJECT INSIDE THE PROJECT`s ROOT FOLDER
#THEN EXECUTE
source venv/bin/activate
usage: producer.py [-h] --env ENV [--template TEMPLATE] [--json-source JSON_SOURCE] [--json-source-key-path JSON_SOURCE_KEY_PATH] [--topic TOPIC] [--count COUNT] [--workers WORKERS] [--start START]
                   [--assign ASSIGN]

Producer

options:
  -h, --help            show this help message and exit
  --env ENV, -e ENV     Environment where you wanna produce
  --template TEMPLATE, -t TEMPLATE
                        The template to be produced
  --json-source JSON_SOURCE, -j JSON_SOURCE
                        A file containing an JSON object per line
  --json-source-key-path JSON_SOURCE_KEY_PATH
                        The json path for the key Like: {id:{serial: 1, position:0}, some_value:1} -> id.serial to access serial value you can combine multiple paths like: a.b,a.b.c they will be dash joined
  --topic TOPIC         A topic that will replace the config`s default topic
  --count COUNT, -c COUNT
                        Number of events you wanna produce
  --workers WORKERS, -w WORKERS
                        Number of parallel workers
  --start START, -s START
                        The start offset of the event position
  --assign ASSIGN       You can assign values to your template using python glom query language Like: --assign=a.b='U' to replace {a:{b:'A' to 'U'}}

# assuming that the config file has already an environment called <local> and you already have a template defined, to produce an event it would be

python producer.py -e local

[2023-07-25 15:45:14,331][INFO][__main__] - producing 1 env[local] topic[topic_name_example]
[2023-07-25 15:45:14,448][INFO][Worker-1] - 1 events produced

python-mock-kafka-producer's People

Contributors

brunosilvaandrade avatar

Stargazers

João Gabriel Souza avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.