Giter Club home page Giter Club logo

dotnet-kafka-example's Introduction

dotnet-kafka-example

This is a small example where two simple applications serve as producer and consumer for Kafka, respectively. The applications don't mind about topic partitions as they were developed just to showcase how easy using Kafka with .NET is, specially with the Confluent.Kafka package.

Running the Applications

First, we need Kafka to be running for both applications to work. We will be using the bitnami/kafka:latest Docker image specified in the docker-compose.yml. To spin up the container, we just need to run:

# When using an older version of docker, run docker-compose up instead
docker compose up

The solution file already references the two projects, so we can build both for debugging by running dotnet build, but we can also build and run by using both:

dotnet run --project Example.ConsoleProducer
dotnet run --project Example.ConsoleConsumer

Note: The consumer will throw an error if started first because the Kafka container needs the topic to be created before it can serve the messages. Running the producer first automatically creates the topic and sends the messages.

Now everything should be running and everytime we execute the producer application now, we will see the messages being received by the consumer almost instantly!

License

MIT

dotnet-kafka-example's People

Contributors

ikroeber avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.