Getting Started with Kafka

Kafka with Docker on your local machine

Matt Moore
Kotlin Thursdays
2 min readApr 29, 2019

--

I’ve set up Kafka on Docker and Docker-Compose for myself and other folks to use on their local laptops.

Installing Docker

To get started, you’ll first need to download and install Docker.

Now that you’re signed in, head to your terminal and check that the CLI is installed with:

Running Kafka in Docker

Next, git clone my kafka-standalone docker setup.

This will download and spin up the necessary docker containers to run kafka on your local laptop. This may take a few minutes, depending on your internet connection and laptop speed. When it’s finished, you can check that it’s running correctly:

Creating A Topic

You can create a new topic in Kafka to send and receive messages on:

Sending Messages on Kafka

You can spin up a producer to send messages with:

Once that spins up, you should be able to type messages and send them by hitting the enter key:

Receiving Messages on Kafka

You can spin up a consumer to receive messages:

You should see your message show up:

That’s about it! You’re ready to start building applications with Kafka!

Building an Order System with Kotlin, Kafka, and Domain-Driven Design

Kafka is a scalable event-driven message system able to communicate in intense and complex systems. In the next post, we’ll be demonstrating the power of Kafka by building an online-ordering system!

--

--

Matt Moore
Kotlin Thursdays

Engineering leader in Chicago. Distributed Computing. Functional Programming. AI/ML.