Class PollingFeeder

java.lang.Object
software.spool.publisher.api.strategy.PollingFeeder
All Implemented Interfaces:
FeederStrategy

public class PollingFeeder extends Object implements FeederStrategy
Polling-based FeederStrategy that periodically reads inbox items with PUBLISHING status and processes them.

When started, this strategy creates a single-threaded scheduled executor that queries the inbox at a fixed interval (default: 30 seconds). Each matching inbox item is converted to an InboxItemStored event and delegated to the handler.

This strategy is best suited for batch-oriented or high-throughput scenarios where periodic polling is more efficient than event-driven processing.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PollingFeeder(InboxReader reader, software.spool.core.control.Handler<software.spool.core.model.InboxItemStored> handler, Duration interval)
    Creates a new polling feeder.
  • Method Summary

    Modifier and Type
    Method
    Description
    software.spool.core.port.Subscription
    Starts a scheduled executor that polls the inbox at the configured interval.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.spool.publisher.api.strategy.FeederStrategy

    stop
  • Constructor Details

    • PollingFeeder

      public PollingFeeder(InboxReader reader, software.spool.core.control.Handler<software.spool.core.model.InboxItemStored> handler, Duration interval)
      Creates a new polling feeder.
      Parameters:
      reader - the inbox reader for querying items by status
      handler - the handler that processes each inbox item
      interval - the polling interval; defaults to 30 seconds if null
  • Method Details

    • start

      public software.spool.core.port.Subscription start()
      Starts a scheduled executor that polls the inbox at the configured interval.
      Specified by:
      start in interface FeederStrategy
      Returns:
      a Subscription whose cancel() shuts down the scheduler