Event-Driven

Polling Publisher

Description

A polling process periodically queries the database for new events (like in an Outbox) and publishes them to a message broker.

Where to use

  • Simplest Outbox implementation.
  • \n
  • Systems without CDC support.

Real World Example

A Cron job runs every 1 second: SELECT * FROM outbox WHERE sent=false; publish(); UPDATE set sent=true;

Code Example

class PollingPublisher:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Polling Publisher')