From another terminal, run the following command to run the consumer application which will read the events from the purchases topic and write the information to the terminal.
Copy
Ask AI
./out/consumer
The consumer application will start and print any events it has not yet consumed and then wait for more events to arrive. On startup of the consumer, you should see output resembling this:
Copy
Ask AI
Consumed event from topic purchases: ID = 890243:0:2, key = awalther value = batteriesConsumed event from topic purchases: ID = 890243:1:2, key = htanaka value = bookConsumed event from topic purchases: ID = 890243:2:2, key = jbernard value = t-shirtsConsumed event from topic purchases: ID = 890243:3:2, key = eabara value = gift cardConsumed event from topic purchases: ID = 890243:4:2, key = htanaka value = batteriesConsumed event from topic purchases: ID = 890243:5:2, key = htanaka value = bookConsumed event from topic purchases: ID = 890243:6:2, key = awalther value = t-shirtsConsumed event from topic purchases: ID = 890243:7:2, key = awalther value = t-shirtsConsumed event from topic purchases: ID = 890243:8:2, key = sgarcia value = bookConsumed event from topic purchases: ID = 890243:9:2, key = awalther value = gift card
Rerun the producer to see more events, or feel free to modify the code as necessary to create more or different events.Once you are done with the consumer, enter Ctrl-C to terminate the consumer application.