Class PollingFeederBuilder

java.lang.Object
software.spool.publisher.api.builder.PollingFeederBuilder

public class PollingFeederBuilder extends Object
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 Details

    • from

      public PollingFeederBuilder from(InboxReader reader)
      Sets the inbox reader for querying items by status.
      Parameters:
      reader - the inbox reader; must not be null
      Returns:
      this builder for chaining
    • with

      public PollingFeederBuilder with(software.spool.core.port.InboxUpdater updater)
      Sets the inbox updater used to change inbox item statuses.
      Parameters:
      updater - the inbox updater; must not be null
      Returns:
      this builder for chaining
    • on

      public PollingFeederBuilder on(software.spool.core.port.EventBusEmitter emitter)
      Sets the event bus emitter for publishing ItemPublished events.
      Parameters:
      emitter - the event bus emitter; must not be null
      Returns:
      this builder for chaining
    • each

      public PollingFeederBuilder each(Duration interval)
      Sets the polling interval.
      Parameters:
      interval - the interval between polls; defaults to 30 seconds if not set
      Returns:
      this builder for chaining
    • withErrorRouter

      public PollingFeederBuilder withErrorRouter(software.spool.core.utils.ErrorRouter errorRouter)
      Sets the error router for handling exceptions during publishing.
      Parameters:
      errorRouter - the error router; must not be null
      Returns:
      this builder for chaining
    • create

      public Feeder create()
      Builds and returns the configured polling Feeder.
      Returns:
      a new Feeder ready to start publishing
      Throws:
      NullPointerException - if any required port has not been set