Class PollingFeederBuilder
java.lang.Object
software.spool.publisher.api.builder.PollingFeederBuilder
Fluent builder that configures and assembles a polling-based
Feeder.
The resulting feeder periodically queries the inbox for items with
PUBLISHING status and processes them. All ports are automatically
wrapped in their corresponding Safe* decorators.
Feeder feeder = FeederBuilderFactory.polling()
.from(inboxReader)
.with(inboxUpdater)
.on(eventBusEmitter)
.each(Duration.ofSeconds(15))
.withErrorRouter(errorRouter)
.create();
-
Method Summary
Modifier and TypeMethodDescriptioncreate()Builds and returns the configured pollingFeeder.Sets the polling interval.from(InboxReader reader) Sets the inbox reader for querying items by status.on(software.spool.core.port.EventBusEmitter emitter) Sets the event bus emitter for publishingItemPublishedevents.with(software.spool.core.port.InboxUpdater updater) Sets the inbox updater used to change inbox item statuses.withErrorRouter(software.spool.core.utils.ErrorRouter errorRouter) Sets the error router for handling exceptions during publishing.
-
Method Details
-
from
Sets the inbox reader for querying items by status.- Parameters:
reader- the inbox reader; must not benull- Returns:
- this builder for chaining
-
with
Sets the inbox updater used to change inbox item statuses.- Parameters:
updater- the inbox updater; must not benull- Returns:
- this builder for chaining
-
on
Sets the event bus emitter for publishingItemPublishedevents.- Parameters:
emitter- the event bus emitter; must not benull- Returns:
- this builder for chaining
-
each
Sets the polling interval.- Parameters:
interval- the interval between polls; defaults to 30 seconds if not set- Returns:
- this builder for chaining
-
withErrorRouter
Sets the error router for handling exceptions during publishing.- Parameters:
errorRouter- the error router; must not benull- Returns:
- this builder for chaining
-
create
Builds and returns the configured pollingFeeder.- Returns:
- a new
Feederready to start publishing - Throws:
NullPointerException- if any required port has not been set
-