rpk topic produce
An rpk command that reads lines from standard input and writes each one to a topic as a record.
In more detail
Pass --key (or -k) to set a record key and --partition to force a specific partition. In the course, text is piped in with echo and docker exec -i so the input reaches the command inside the container.
Example
echo login | docker exec -i broker rpk topic produce events --key u1Related terms
- rpk — The command-line tool that ships with Redpanda for starting brokers and managing topics, consumer groups and schemas.
- producer — The program that creates and sends messages or events.
- record key — An optional value attached to a record that decides which partition it goes to, so all records with the same key stay together and in order.
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
Taught in
- Why A Log And Not A Queue — Apache Kafka & Event Streaming
- Topics, Partitions And Where A Record Lands — Apache Kafka & Event Streaming
- Offsets: Position, Not Acknowledgement — Apache Kafka & Event Streaming
- A Consumer In Python — Apache Kafka & Event Streaming