kafka-faker

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Kafka Faker

Kafka Faker is a fake message generator for kafka. It generates fake messages based on a schema and sends them to a kafka topic.

It's useful for a service that consumes messages from kafka, stream processing with tools (e.g. Apache Flink) or testing.

Configuration

kafka:
  brokers: localhost:29092
generators:
  - topic: sample_topic
    partitionKey: any
    template: |-
      {
        "name": "{{ personName }}",
        "email": "{{ email }}",
        "from_address": "{{ ethereumAddress }}",
        "to_address": "{{ ethereumAddress }}",
        "amount": "{{ intBetween 1 1000 }}",
        "timestamp": "{{ timestamp }}"
      }
    number: 5
    loop: true
    delay: 2s

Test

First of all, you need to run kafka to test this app locally. Use docker-compose to run kafka and kafka-ui.

$ docker-compose up -d

Then, build & run kafka-faker with the config file.

$ go build -o ./bin/kafka-faker .
$ ./bin/kafka-faker --config-file=config.yml

Generated messages shows on kafka-ui

Visit kafka-ui to see the generated messages. If you use docker-compose file. you can visit the kafka-ui at http://localhost:8080/

LICENSE

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址