Code Monkey home page Code Monkey logo

kafka-avro-cli's Introduction

Kafka-avro-cli

CLI tool for writing Avro serialized messages into Kafka

Features

  • TLS support
  • Confluent Schema Registry support

Installation

You can download a prebuild x86_64-unknown-linux-gnu binary in the Releases section or build it from sources with cargo build --release

Dependencies

To build the binary you'll need:

  • the GNU toolchain
  • GNU make
  • pthreads
  • libssl-dev

Runtime dependencies:

  • libssl

Usage

  USAGE:
      kafka-avro-cli produce [FLAGS] [OPTIONS] --hosts <host:port[,host:port[...]]> --topic <TOPIC>
  
  FLAGS:
          --help                    Prints help information
          --ssl.disable.validate    Do not validate broker's certificate
          --ssl                     Use SSL
          --ssl.host.validate       To validate broker's hostname
      -T, --text                    Message input is just a plain text. (JSON by default)
      -V, --version                 Prints version information
  
  OPTIONS:
      -h, --hosts <host:port[,host:port[...]]>    Kafka hosts
      -p, --payload <JSON>
              Message payload. JSON expected if '--text' flag is not present
  
          --payload-file <PATH>
              New-line delimited file. Each row is a message payload. (JSON or plain text in respect
              with `text`)
  
          --registry-url <http[s]://host:port>    Schema-registry url
      -s, --schema <SCHEMA JSON>                  Avro schema used to serialize payload
          --schema-file <PATH>
              File containing the Avro schema used to serialize payload
  
          --ssl.ca.location <PATH>
              File or directory path to CA certificate(s) for verifying the broker's key. (PEM)
  
          --ssl.keystore.location <PATH>          Path to client's keystore (PKCS#12)
          --ssl.keystore.password <PATH>          Client's keystore (PKCS#12) password
      -t, --topic <TOPIC>                         Topic name

Examples

Produce simple text message:

kafka-avro-cli produce -h localhost:9092 -t my-topic -T -p "Hello Kafka!"

Produce json message with avro schema:

kafka-avro-cli produce -h localhost:9092 -t my-topic -p '{"msg": "Hello Kafka!"}' -s '{"name":"msg", "type": "record", "fields": [{"name": "msg", "type": "string"}]}'

Produce json message with avro schema and register the schema in schema-registry:

kafka-avro-cli produce -h localhost:9092 -t my-topic --registry-url http://localhost:8081 -p '{"msg": "Hello Kafka!"}' -s '{"name":"msg", "type": "record", "fields": [{"name": "msg", "type": "string"}]}'

Produce json message using already registered schema

kafka-avro-cli produce -h localhost:9092 -t my-topic --registry-url http://localhost:8081 -p '{"msg": "Hello Kafka!"}'

kafka-avro-cli's People

Contributors

apohrebniak avatar

Stargazers

 avatar

Watchers

 avatar

kafka-avro-cli's Issues

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.