#2673: Microservice pattern: Polling publisher #3243#3292
Conversation
…cture, README.md & App.java
…ifferent operation & prepared initial skeleton
… & implemented polling-service microservice
…te dependency from pom.xml & added required one
PR SummaryThis PR introduces a microservice-based architecture using Kafka for communication between a polling publisher and a subscriber service. It includes REST endpoints, Kafka producers and consumers, Spring Boot configurations, and testing for message flow validation. Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (30)
- e49025f: Merge branch 'master' into issue-2673
- e0dbd48: Merge branch 'issue-2673' of https://github.com/quantdevv/java-design-patterns into issue-2673
- 256d81b: addressed review comment: removed unnecessary dependency
- ff872e7: used logger to print statement
- f16fb4f: fixed the printing statements & used log function
- 6b1fefd: deleted unnecessary README.md files
- ee8c228: improved the README.md file & fixed it's format
- c2848da: Updated README.md file based on new template
- 589fe40: merged changes from origin/master
- f799e6f: Merge branch 'iluwatar:master' into issue-2673
- 8c50536: Merge branch 'master' into issue-2673
- 059f292: added polling-publisher module in pom.xml
- 84d08f0: added scope before class definition in Test classes & removed duplicate dependency from pom.xml & added required one
- 5e3c951: synced with remote branch
- 24b87bb: added description on both application.yaml file
- 4eeb011: updated all README.md
- 5aa46ac: added new listener for other topic
- a59362c: Fixed topic name
- 1b3d933: Fixed subscriber-service & updated pom.xml
- 46abbfb: Fixed Kafka bug & added a controller to send message using API
- a7cc2c3: implemented subscriber microservice using kafkaConsumer
- a7497c4: implemented Data repository, DataSource Service & added unittest-case & implemented polling-service microservice
- 78f1ea9: resolved dependency & structured classes
- 931ab84: added unit test-case for DataSourceService class
- bb065d3: added entry point for subscriber service & unit test-case
- 4988d2e: subscriber-service implementation
- a2b8743: fixed checkstyle errors
- 0051d3f: polling-publisher service implementation
- c4e9276: added two service polling service & publisher service to handle two different operation & prepared initial skeleton
- faf0a12: added new microservice pattern polling-publisher, created folder structure, README.md & App.java
Files Processed (22)
- polling-publisher/README.md (1 hunk)
- polling-publisher/etc/polling-publisher.urm.puml (1 hunk)
- polling-publisher/polling-service/etc/polling-service.urm.puml (1 hunk)
- polling-publisher/polling-service/pom.xml (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/App.java (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/DataRepository.java (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/DataSourceService.java (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/KafkaProducer.java (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/PollingController.java (1 hunk)
- polling-publisher/polling-service/src/main/java/com/iluwatar/polling/PollingScheduler.java (1 hunk)
- polling-publisher/polling-service/src/main/resources/application.yml (1 hunk)
- polling-publisher/polling-service/src/test/java/com/iluwatar/polling/AppTest.java (1 hunk)
- polling-publisher/polling-service/src/test/java/com/iluwatar/polling/DataRepositoryTest.java (1 hunk)
- polling-publisher/polling-service/src/test/java/com/iluwatar/polling/DataSourceServiceTest.java (1 hunk)
- polling-publisher/pom.xml (1 hunk)
- polling-publisher/subscriber-service/etc/subscriber-service.urm.puml (1 hunk)
- polling-publisher/subscriber-service/pom.xml (1 hunk)
- polling-publisher/subscriber-service/src/main/java/com/iluwatar/subscriber/App.java (1 hunk)
- polling-publisher/subscriber-service/src/main/java/com/iluwatar/subscriber/KafkaConsumer.java (1 hunk)
- polling-publisher/subscriber-service/src/main/resources/application.yml (1 hunk)
- polling-publisher/subscriber-service/src/test/java/com/iluwatar/subscriber/AppTest.java (1 hunk)
- pom.xml (1 hunk)
Actionable Comments (0)
Skipped Comments (0)
|
|
Hi @iluwatar , can you please have a look on this..? |
| @Component | ||
| public class KafkaProducer { | ||
|
|
||
| @Autowired private final KafkaTemplate<String, String> kafkaTemplate; |
There was a problem hiding this comment.
yes sure , improved 👍
| return "Polling Service is up and running!"; | ||
| } | ||
|
|
||
| @Autowired private KafkaProducer kafkaProducer; |
There was a problem hiding this comment.
multiline and better be before request mapping
There was a problem hiding this comment.
Hi @ronodhirSoumik , we can't make it multiline due spotless maven plugin & have to keep in-line it..
yeah changed other changes...
Thanks
|
|
||
| if (data != null) { | ||
| log.info("🟢 Publishing Data: {}", data); | ||
| kafkaProducer.sendMessage("updates", data); |
There was a problem hiding this comment.
can use try-catch here
There was a problem hiding this comment.
Thanks for all the review. i made necessary changes & will raise PR.
|
|
Hi @iluwatar can you please have a look..? |
|
This PR is stale because it has been open 60 days with no activity. |
|
@all-contributors please add @quantdevv for code |
|
I've put up a pull request to add @quantdevv! 🎉 |




Pull Request
What does this PR do?
This PR introduces a microservice-based architecture that includes a polling-publisher and a subscriber-service communicating via Apache Kafka. It demonstrates an in-memory data flow mechanism using Kafka topics.
The PR includes:
Fixes #2673
Type of change
How has this been tested?
Additional context
Both microservices are designed for local Kafka communication using port 9092. Make sure the Kafka broker is running before testing