Skip to content

aryan735/Dellivery-Microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kafka Integration with DeliveryBoy and EndUser 🚚📦

This project demonstrates how to integrate Apache Kafka with the DeliveryBoy and EndUser microservices, enabling efficient messaging and data flow between them. Built with Spring Boot, this project features both Kafka producer and consumer implementations.

🛠️ Features

  • Kafka Producer & Consumer setup for two microservices: DeliveryBoy and EndUser.
  • Kafka Configuration for both microservices via application.yml files.
  • Kafka Service implementations to manage message flow between services.
  • Integration of Kafka topics for communication.

📂 Project Structure

DeliveryBoy Microservice:

  • KafkaConfig.java: Configures Kafka producer and consumer.
  • LocationController.java: Handles incoming location-related requests.
  • KafkaService.java: Contains Kafka producer and consumer logic.
  • application.yml: Kafka configuration (topic names, bootstrap servers, etc.).

EndUser Microservice:

  • KafkaConfig.java: Configures Kafka producer and consumer.
  • AppConstants.java: Contains constants used throughout the application.
  • application.yml: Kafka configuration (topic names, bootstrap servers, etc.).

🛠️ Setup Instructions

1. Prerequisites

Before you begin, ensure that you have the following installed:

  • Java 17 or above
  • Apache Kafka and Zookeeper running locally or remotely
  • Maven for building and running the project

2. Running Kafka & Zookeeper

First, make sure that Zookeeper and Kafka are up and running. Open separate terminal windows and start them:

# Start Zookeeper
bin\windows\zookeeper-server-start.bat config\zookeeper.properties

# Start Kafka
bin\windows\kafka-server-start.bat config\server.properties
3. Running the Microservices
Now, navigate to the deliveryboy and enduser directories in separate terminals and run:
# For DeliveryBoy microservice
mvn spring-boot:run

# For EndUser microservice
mvn spring-boot:run
4. Creating Topics in Kafka
You may need to create topics for communication between the services. Use the following commands to create topics:
# Create Kafka topics (Example)
bin\windows\kafka-topics.sh --create --topic delivery-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
bin\windows\kafka-topics.sh --create --topic enduser-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
5. Testing the Communication
After starting both services and creating the topics, you can test communication by sending messages through the Kafka producer and consuming them with the consumer logic in both microservices.

📜 Technologies Used
Spring Boot

Apache Kafka

Java 17

Maven

🧑‍💻 Contributing
Feel free to fork this repository and submit pull requests. Contributions are always welcome! 🙌

📝 License
This project is licensed under the MIT License - see the LICENSE file for details.

Feel free to connect and share your thoughts on this project! 😄

markdown
Copy
Edit

### Steps to Add to Your Repository:
1. **Create a `README.md` file** at the root of your project if it doesn't already exist.
2. **Paste the content** above into your `README.md` file.
3. **Commit and push** it to your GitHub repository:

```bash
git add README.md
git commit -m "Added stylish README with project details"
git push origin main

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages