Skip to content
A simple implementation of a Kafka producer and consumer in F#
F# Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple implementation of a Kafka producer and consumer in F#

execute the following to build it in Docker:

git clone
cd fsharp-kafka-simple
sudo sh

Spin up Kafka with the following:

docker run -d -p 2181:2181 -h --name zookeeper confluent/zookeeper

docker run -d -p 9092:9092 -h --name kafka --link zookeeper:zookeeper confluent/kafka

Add the following to your /etc/hosts on the machine hosting the fsharp-kafka-producer & fsharp-kafka-consumer:


Now you can stream data into Kafka (from , for instance) using something like:

docker run --rm -i generate-race 5000 3 | docker run -i --rm --net host fsharp-kafka-producer reads

We can stream that data out of Kafka and into another microservice, then stream the results back into Kafka like:

docker run --rm --net host fsharp-kafka-consumer reads | docker run -i --rm streaming-fsharp | docker run -i --rm --net host fsharp-kafka-producer results

And you can read it back using:

docker run -i --rm --net host fsharp-kafka-consumer results
You can’t perform that action at this time.