Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rlnkoo/kafka-producer
Kafka example of serialize and deserialize code
https://github.com/rlnkoo/kafka-producer
java kafka spring
Last synced: 18 days ago
JSON representation
Kafka example of serialize and deserialize code
- Host: GitHub
- URL: https://github.com/rlnkoo/kafka-producer
- Owner: rlNkoo
- Created: 2024-11-01T07:25:52.000Z (19 days ago)
- Default Branch: master
- Last Pushed: 2024-11-01T07:35:34.000Z (19 days ago)
- Last Synced: 2024-11-01T08:24:53.565Z (19 days ago)
- Topics: java, kafka, spring
- Language: Java
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kafka Producer Application
This project contains a simple producer application for Apache Kafka, demonstrating how to set up and run Kafka locally. Apache Kafka is a distributed streaming platform that allows you to publish, subscribe to, store, and process data in real time.
## Introduction
Follow these instructions to set up Apache Kafka and run a producer and consumer application in your local environment.## Starting Zookeeper and Kafka
Apache Kafka relies on Zookeeper to manage brokers and handle distributed synchronization. Start the Zookeeper server and Kafka server in separate terminal windows.### 1. Start Zookeeper Server
Run the following command to start the Zookeeper server:sh bin/zookeeper-server-start.sh config/zookeeper.properties
### 2. Start Kafka Server / Broker
In another terminal window, start the Kafka broker (server) with:sh bin/kafka-server-start.sh config/server.properties
### 3. Create a Topic
To create a new Kafka topic, use the following command. Replace NewTopic with your desired topic name. This topic will have 3 partitions and a replication factor of 1:sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic NewTopic --partitions 3 --replication-factor 1
### 4. List All Topic Names
To view all existing Kafka topics, use:sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --list
### 5. Describe Topics
To get details about a specific topic (e.g., NewTopic), use:sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic NewTopic
### 6. Produce a Message
You can produce messages to the NewTopic topic by using the console producer. After running this command, type messages and press Enter to send them:sh bin/kafka-console-producer.sh --broker-list localhost:9092 --topic NewTopic
### 7. Consume Messages
To consume messages from the NewTopic topic, use the console consumer. This command will show messages from the beginning of the topic:sh bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic NewTopic --from-beginning