File: README.md

package info (click to toggle)
golang-github-ibm-sarama 1.46.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,072 kB
  • sloc: makefile: 40; sh: 30
file content (34 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# kafka-console-producer

A simple command line tool to produce a single message to Kafka.

### Installation

    go get github.com/IBM/sarama/tools/kafka-console-producer


### Usage

    # Minimum invocation
    kafka-console-producer -topic=test -value=value -brokers=kafka1:9092

    # It will pick up a KAFKA_PEERS environment variable
    export KAFKA_PEERS=kafka1:9092,kafka2:9092,kafka3:9092
    kafka-console-producer -topic=test -value=value

    # It will read the value from stdin by using pipes
    echo "hello world" | kafka-console-producer -topic=test

    # Specify a key:
    echo "hello world" | kafka-console-producer -topic=test -key=key

    # Partitioning: by default, kafka-console-producer will partition as follows:
    # - manual partitioning if a -partition is provided
    # - hash partitioning by key if a -key is provided
    # - random partitioning otherwise.
    #
    # You can override this using the -partitioner argument:
    echo "hello world" | kafka-console-producer -topic=test -key=key -partitioner=random

    # Display all command line options
    kafka-console-producer -help