-
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat: Microservice Messaging Pattern (#2681) #3421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add initial project structure for microservices-messaging using Spring Boot. Includes Maven configuration with dependencies for Kafka, Lombok, and testing, as well as main application, test class, and application properties.
1. Added initial project structure for demonstrating the microservices messaging pattern. 2. Introduced service stubs (OrderService, InventoryService, PaymentService, NotificationService), a Message and MessageBroker class, and a main App entry point. 3. Added README and logging configuration.
1. Added the Message class with unique ID, content, and timestamp fields, and a toString method. 2. Implemented the MessageBroker class to support topic-based publish-subscribe messaging, including subscriber management, message publishing, and logging.
1. Added message handling logic to InventoryService, PaymentService, and NotificationService. 2. OrderService now publishes order events to a MessageBroker, and App demonstrates the messaging workflow. 3. Each service processes relevant order events and logs actions for demonstration purposes.
1. Enhanced the README with detailed explanations, real-world examples, Java code samples, and references for the Microservices Messaging pattern. 2. Added flowchart and sequence diagram images to illustrate the pattern.
1. Added Apache Kafka for asynchronous communication between services. 2. Added KafkaMessageProducer and KafkaMessageConsumer classes, updated service implementations and main application logic to use Kafka, and adjusted the Maven configuration to include Kafka and Jackson dependencies. 3. Updated and moved all classes to the com.iluwatar.messaging package, improved documentation, and updated diagrams to reflect the new architecture.
1. Added comprehensive unit tests for App, InventoryService, KafkaMessageConsumer, KafkaMessageProducer, Message, NotificationService, OrderService, and PaymentService. 2. Added MIT license headers to all main source files and logback.xml. 3. Updated pom.xml to include JUnit Jupiter as a test dependency.
PR SummaryStarted a new Microservices Messaging module demonstrating a Kafka-based publish/subscribe workflow across services. Introduced App, producer/consumer components, message model, and service stubs (Order, Inventory, Payment, Notification). Added end-to-end messaging workflow via Kafka, unit tests, and documentation with diagrams; updated Maven config to include Kafka/Jackson dependencies. Changes
autogenerated by presubmit.ai |
1. Simplified unit tests for InventoryService, NotificationService, and PaymentService by removing null content tests and adding instantiation checks. 2. Refactored KafkaMessageConsumerTest and KafkaMessageProducerTest to avoid requiring a real Kafka instance, focusing on class structure and method existence instead of integration behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 98e442e: Refactor and simplify service and Kafka test classes
- Simplified unit tests for InventoryService, NotificationService, and PaymentService by removing null content tests and adding instantiation checks.
- Refactored KafkaMessageConsumerTest and KafkaMessageProducerTest to avoid requiring a real Kafka instance, focusing on class structure and method existence instead of integration behavior.
Files Processed (21)
- microservices-messaging/README.md (1 hunk)
- microservices-messaging/etc/microservices-messaging-flowchart.png (0 hunks)
- microservices-messaging/etc/microservices-messaging-sequence-diagram.png (0 hunks)
- microservices-messaging/pom.xml (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/App.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/InventoryService.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/KafkaMessageConsumer.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/KafkaMessageProducer.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/Message.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/NotificationService.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/OrderService.java (1 hunk)
- microservices-messaging/src/main/java/com/iluwatar/messaging/PaymentService.java (1 hunk)
- microservices-messaging/src/main/resources/logback.xml (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/AppTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/InventoryServiceTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/KafkaMessageConsumerTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/KafkaMessageProducerTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/MessageTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/NotificationServiceTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/OrderServiceTest.java (1 hunk)
- microservices-messaging/src/test/java/com/iluwatar/messaging/PaymentServiceTest.java (1 hunk)
Actionable Comments (1)
-
microservices-messaging/src/main/java/com/iluwatar/messaging/Message.java [36-37]
bug: "Missing Lombok-based getters for Message"
Skipped Comments (0)
microservices-messaging/src/main/java/com/iluwatar/messaging/Message.java
Show resolved
Hide resolved
|
|
@iluwatar Please review! |



Issue : #2681