Sample code for IBM Event Streams Coding Challenge

Ong Khai Wei
1 min readJan 16, 2022

Coding is always fun. Recently I found a coding challenge for Event Streams https://developer.ibm.com/learningpaths/ibm-event-streams-badge/event-streams-coding-challenge/.

The coding challenge is simple and straightforward — is to write a Kafka consumer application based on the template code provided. There is no sample answer to verify for the expected outcome.

I learned something new from this coding challenge, the example given implements ConsumerRebalanceListener, this allows developer to have greater control over the partitions and the offset of each partition for event processing.

Once the coding is complete, you can execute the following command to clean the build folder and build the Consumer application.

gradle clan & gradle build

Execute java -jar to run the application with BROKER_URLS and APIKEY from IBM Cloud.

java -jar ./build/libs/coding-challenge-consumer.jar <BROKER_URLS> <APIKEY>

Secret message will be displayed in Terminal.

Sample code is available at https://github.com/ongkhaiwei/eventstreams-badge-sample

--

--