spring-kafka-de-serialization-types
spring-kafka-de-serialization-types copied to clipboard
The goal is to play with Spring Kafka. We've implemented 5 examples of producer and consumer services that exchanges messages through Kafka using different types of serialization and approaches.
spring-kafka-de-serialization-types
The goal of this project is to play with Spring for Apache Kafka. We've implemented 5 examples of producer and consumer services that exchanges messages through Kafka using different types of serialization and approaches.
Proof-of-Concepts & Articles
On ivangfr.github.io, I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in by using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.
Examples
The following examples demonstrate a producer that pushes "News" messages to a topic in Kafka and a consumer that listens those messages from Kafka.
| Example | Diagram |
|---|---|
| string-de-serialization | ![]() |
| json-de-serialization | ![]() |
| avro-de-serialization | ![]() |
| avro-2-de-serialization | ![]() |
| avro-3-de-serialization | ![]() |
Prerequisites
Start Environment
-
Open a terminal and inside
spring-kafka-de-serialization-typesroot folder run:docker compose up -d -
Wait for Docker containers to be up and running. To check it, run:
docker compose ps
Useful Links
-
Schema Registry UI
Schema Registry UIcan be accessed at http://localhost:8001 -
Kafka Topics UI
Kafka Topics UIcan be accessed at http://localhost:8085 -
Kafka Manager
Kafka Managercan be accessed at http://localhost:9000Configuration
- First, you must create a new cluster. Click on
Cluster(dropdown on the header) and then onAdd Cluster; - Type the name of your cluster in
Cluster Namefield, for example:MyCluster; - Type
zookeeper:2181inCluster Zookeeper Hostsfield; - Enable checkbox
Poll consumer information (Not recommended for large # of consumers if ZK is used for offsets tracking on older Kafka versions); - Click on
Savebutton at the bottom of the page.
- First, you must create a new cluster. Click on
Shutdown
To stop and remove docker compose containers, network and volumes, go to a terminal and, inside spring-kafka-de-serialization-types root folder, run the command below:
docker compose down -v
Cleanup
To remove the Docker created by this project, go to a terminal and, inside spring-kafka-de-serialization-types root folder, run the following script:
./remove-docker-images.sh all
References
- https://codenotfound.com/spring-kafka-consumer-producer-example.html
- https://codenotfound.com/spring-kafka-json-serializer-deserializer-example.html
- https://codenotfound.com/spring-kafka-apache-avro-serializer-deserializer-example.html



