Wanna build a .NET Core Kafka Consumer example? See my repo at https://github.com/jcorreaviana/kafka-consumer-example
Option | Description | Default Port in docker-file |
---|---|---|
.NET Core | .NET Core Version 3.1 | http://localhost:8082 |
Kafka Host (set to go in docker compose file) | From Docker Hub | http://localhost:9092 |
Zookeeper (set to go in docker compose file) | From Dcoker Hub | 2181 |
dotnet restore
dotnet build
Where "netcorekafkaproducer" is an example of name choosed for one image
docker build --no-cache -t netcorekafkaproducer .
If you change the name of image, change the value of image in docker-compose
file to mantaint it consistent. Then, in the directory where the docker-file is, run
docker-compose up
To do this, run in your terminal (in this case, running in Ubuntu 20.04)
kafka-topics.sh --bootstrap-server localhost:9092 --list
To do this, run in your terminal (in this case, running in Ubuntu 20.04)
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kafka-topic --property print.key=true --property key.separator=:
The last two parameters is for show the key of message in terminal and the second to use ":" for separate the key and message.
Example: key_value : message_value
Suggestions to send beautiful examples? Use brazilians classic cars :)
{
"model": "Opala",
"year": "1987"
}
...
{
"model": "Gol GTS",
"year": "1989"
}
And others... :)
This result is like this.
Wanna build a .NET Core Kafka Consumer example? See my repo at https://github.com/jcorreaviana/kafka-consumer-example
#iswe