Class PollingFeeder
java.lang.Object
software.spool.publisher.api.strategy.PollingFeeder
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionPollingFeeder(InboxReader reader, software.spool.core.control.Handler<software.spool.core.model.InboxItemStored> handler, Duration interval) Creates a new polling feeder. -
Method Summary
Modifier and TypeMethodDescriptionsoftware.spool.core.port.Subscriptionstart()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, waitMethods 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 statushandler- the handler that processes each inbox iteminterval- the polling interval; defaults to 30 seconds ifnull
-
-
Method Details
-
start
public software.spool.core.port.Subscription start()Starts a scheduled executor that polls the inbox at the configured interval.- Specified by:
startin interfaceFeederStrategy- Returns:
- a
Subscriptionwhosecancel()shuts down the scheduler
-