1. Python
  2. Tutorial

Consume Messages

Make the consumer.py file executable by running the following command:

chmod +x consumer.py

Run the consumer by executing the following command:

./consumer.py

You should see output resembling this:

Consumed event from topic purchases: key = awalther     value = batteries
Consumed event from topic purchases: key = awalther     value = gift card
Consumed event from topic purchases: key = awalther     value = book
Consumed event from topic purchases: key = htanaka      value = book
Consumed event from topic purchases: key = jbernard     value = alarm clock
Consumed event from topic purchases: key = eabara       value = gift card
Consumed event from topic purchases: key = jsmith       value = batteries
Consumed event from topic purchases: key = sgarcia      value = alarm clock
Consumed event from topic purchases: key = jsmith       value = book
Consumed event from topic purchases: key = sgarcia      value = alarm clock

Enter Ctrl-C to terminate the consumer application.

Previous
Produce Messages