Debian Codegraph @

tools/kafka-console-producer/README.md

raw
1 # kafka-console-producer
2
3 A simple command line tool to produce a single message to Kafka.
4
5 ### Installation
6
7 go get github.com/Shopify/sarama/tools/kafka-console-producer
8
9
10 ### Usage
11
12 # Minimum invocation
13 kafka-console-producer -topic=test -value=value -brokers=kafka1:9092
14
15 # It will pick up a KAFKA_PEERS environment variable
16 export KAFKA_PEERS=kafka1:9092,kafka2:9092,kafka3:9092
17 kafka-console-producer -topic=test -value=value
18
19 # It will read the value from stdin by using pipes
20 echo "hello world" | kafka-console-producer -topic=test
21
22 # Specify a key:
23 echo "hello world" | kafka-console-producer -topic=test -key=key
24
25 # Partitioning: by default, kafka-console-producer will partition as follows:
26 # - manual partitioning if a -partition is provided
27 # - hash partitioning by key if a -key is provided
28 # - random partioning otherwise.
29 #
30 # You can override this using the -partitioner argument:
31 echo "hello world" | kafka-console-producer -topic=test -key=key -partitioner=random
32
33 # Display all command line options
34 kafka-console-producer -help