rpk topic consume
An rpk command that reads records from a topic and prints them, optionally from a chosen offset and in a chosen format.
In more detail
The -o flag picks the starting offset, --num stops after a number of records and -f sets a format string where %k is the key, %v the value, %o the offset and %p the partition. Headers are not printed unless the format asks for them.
Example
rpk topic consume events -f '%p %o %k %v\n' -o 0 --num 3Related terms
- rpk — The command-line tool that ships with Redpanda for starting brokers and managing topics, consumer groups and schemas.
- consumer — A program that receives and processes messages or events, or more broadly any client that uses an API.
- --num — An rpk topic consume flag that stops the command after it has read the given number of records.
- offset — The permanent position number of a record inside its partition, starting at zero and increasing by one for each record.
Taught in
- Why A Log And Not A Queue — Apache Kafka & Event Streaming
- Offsets: Position, Not Acknowledgement — Apache Kafka & Event Streaming
- Keys And Ordering Per Partition — Apache Kafka & Event Streaming
- Bytes On The Wire: JSON, Avro And Protobuf — Apache Kafka & Event Streaming
- Headers, Envelopes And Event Metadata — Apache Kafka & Event Streaming