iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
90.08k stars 26.61k forks source link

Microservice pattern: Polling publisher #2673

Open iluwatar opened 1 year ago

iluwatar commented 1 year ago

Description: The Polling Publisher design pattern is used within microservices architecture to allow services to periodically check for updates or changes and then publish the results to subscribers. This pattern is particularly useful for ensuring that microservices are loosely coupled and can independently manage their data refresh cycles without requiring direct communication or immediate event-based updates.

Main Elements of the Pattern:

  1. Polling Service: A microservice that periodically checks for updates or changes in a specific data source.
  2. Publisher: The component within the polling service that publishes the updated data to interested subscribers.
  3. Subscriber: Services or components that subscribe to the updates published by the polling service.
  4. Scheduler: A mechanism to trigger the polling service at regular intervals.
  5. Data Source: The source from which the polling service fetches updates.
  6. Communication Protocol: Defines how the polling service communicates with subscribers, typically using RESTful APIs, message brokers, or other asynchronous messaging systems.

References:

Acceptance Criteria:

  1. Implement a basic polling service that checks for updates in a predefined data source at regular intervals.
  2. Ensure the polling service can publish updates to subscribers using a RESTful API or message broker.
  3. Provide a sample subscriber that demonstrates how to consume updates from the polling service.
YashKesh commented 1 year ago

@iluwatar what feature you wanted to add i can do

CoderSleek commented 1 month ago

Hey @iluwatar, I can pick this task up.