Skip to content

Conversation

@Mukul-Howale
Copy link

Issue : #2681

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.
@github-actions
Copy link

github-actions bot commented Jan 21, 2026

PR Summary

Started 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

File Summary
microservices-messaging/README.md Documentation outlining the Microservices Messaging pattern, including Kafka-based asynchronous communication, real-world example with order processing across Inventory, Payment, and Notification services, and diagrams. Provides Java code samples and architectural guidance.
microservices-messaging/etc/microservices-messaging-flowchart.png New flowchart asset illustrating the messaging pattern flow for the microservices-messaging module.
microservices-messaging/etc/microservices-messaging-sequence-diagram.png New sequence diagram asset showing interaction sequence among the microservices in the messaging pattern.
microservices-messaging/pom.xml New Maven module pom configuring Kafka client, Jackson, SLF4J/logging, and testing dependencies (JUnit 5, Mockito); sets main class for assembly.
microservices-messaging/src/main/java/com/iluwatar/messaging/App.java Main application demonstrating a Kafka-based messaging workflow: sets up producers and multiple consumers, and simulates an order lifecycle.
microservices-messaging/src/main/java/com/iluwatar/messaging/InventoryService.java InventoryService consumes messages and updates/restores inventory based on order events (Created/Cancelled).
microservices-messaging/src/main/java/com/iluwatar/messaging/KafkaMessageConsumer.java KafkaMessageConsumer subscribes to a topic, deserializes Message objects from JSON, and dispatches to a handler.
microservices-messaging/src/main/java/com/iluwatar/messaging/KafkaMessageProducer.java KafkaMessageProducer serializes Message to JSON and publishes to a topic with logging.
microservices-messaging/src/main/java/com/iluwatar/messaging/Message.java Message data model with id, content, timestamp; includes JSON constructor, getters, and toString override.
microservices-messaging/src/main/java/com/iluwatar/messaging/NotificationService.java NotificationService processes order-related messages to send confirmations/updates/cancellations.
microservices-messaging/src/main/java/com/iluwatar/messaging/OrderService.java OrderService publishes order events (Created/Updated/Cancelled) to order-topic via the Kafka producer.
microservices-messaging/src/main/java/com/iluwatar/messaging/PaymentService.java PaymentService handles payment-related messages (Created/Cancelled) and simulates processing/refund.
microservices-messaging/src/main/resources/logback.xml Logging configuration for the microservices-messaging module.
microservices-messaging/src/test/java/com/iluwatar/messaging/AppTest.java Unit test skeleton for App main; notes that Kafka must be running for full execution.
microservices-messaging/src/test/java/com/iluwatar/messaging/InventoryServiceTest.java Unit tests for InventoryService validating instantiation and message handling variants without Kafka.
microservices-messaging/src/test/java/com/iluwatar/messaging/KafkaMessageConsumerTest.java Unit tests for KafkaMessageConsumer structure (not requiring a live Kafka instance).
microservices-messaging/src/test/java/com/iluwatar/messaging/KafkaMessageProducerTest.java Unit tests for KafkaMessageProducer structure (not requiring a live Kafka instance).
microservices-messaging/src/test/java/com/iluwatar/messaging/MessageTest.java Comprehensive unit tests for Message: creation, uniqueness, JSON (de)serialization, edge cases and toString.
microservices-messaging/src/test/java/com/iluwatar/messaging/NotificationServiceTest.java Unit tests for NotificationService handling multiple message types.
microservices-messaging/src/test/java/com/iluwatar/messaging/OrderServiceTest.java Unit tests for OrderService using a mocked KafkaMessageProducer to verify publish calls.
microservices-messaging/src/test/java/com/iluwatar/messaging/PaymentServiceTest.java Unit tests for PaymentService handling multiple message types.

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.
Copy link

@github-actions github-actions bot left a 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
  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.
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)

@sonarqubecloud
Copy link

@Mukul-Howale Mukul-Howale marked this pull request as ready for review January 21, 2026 17:41
@Mukul-Howale
Copy link
Author

@iluwatar Please review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant