Exercise: Kafka Application as Consumer and Producer
Write a Kafka application (using Kafka Consumer and Producer APIs) that does the following:
- Consumes messages from a topic, e.g.
input
- Sends the messages to another topic, e.g.
output
- The names of the input and output topics may also be given on the command line
- Apply a transformation on the value, e.g. “upper” the strings
- Uses the value of the messages to decide what topic to send the output messages to
- A record with the value of
topic-1
would be sent to topic-1
topic
Duration: 30 mins
Questions
- What happens when you use the same topic as the input and the output?
- What happens when you Ctrl+C?