Class LocalEventBus.Builder

java.lang.Object
dk.cloudcreate.essentials.reactive.LocalEventBus.Builder
Enclosing class:
LocalEventBus

public static class LocalEventBus.Builder extends Object
Builder class for LocalEventBus.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • busName

      public LocalEventBus.Builder busName(String busName)
      Set the name of the bus. Default value is "default"
      Parameters:
      busName - the name of the bus
      Returns:
      this builder instance
    • parallelThreads

      public LocalEventBus.Builder parallelThreads(int parallelThreads)
      Set the number of parallel asynchronous processing threads. Default value is the number of available processors
      Parameters:
      parallelThreads - the number of parallel asynchronous processing threads
      Returns:
      this builder instance
    • backpressureBufferSize

      public LocalEventBus.Builder backpressureBufferSize(int backpressureBufferSize)
      Set the backpressure size for Sinks.Many's onBackpressureBuffer size. Default value is 1024.
      Parameters:
      backpressureBufferSize - the backpressure size for Sinks.Many's onBackpressureBuffer size
      Returns:
      this builder instance
    • overflowMaxRetries

      public LocalEventBus.Builder overflowMaxRetries(int maxRetries)
      Set the maximum number of retries for events that overflow the Flux. Default value is 20.
      Parameters:
      maxRetries - the maximum number of retries for events that overflow the Flux
      Returns:
      this builder instance
    • queuedTaskCapFactor

      public LocalEventBus.Builder queuedTaskCapFactor(double queuedTaskCapFactor)
      Set the factor to calculate queued task capacity from the backpressureBufferSize. Default value is 1.5.
      Parameters:
      queuedTaskCapFactor - the factor to calculate queued task capacity from the backpressureBufferSize
      Returns:
      this builder
    • onErrorHandler

      public LocalEventBus.Builder onErrorHandler(OnErrorHandler onErrorHandler)
      Set the error handler which will be called if any asynchronous subscriber/consumer fails to handle an event. Default logs an error with the failure details
      Parameters:
      onErrorHandler - the error handler which will be called if any asynchronous subscriber/consumer fails to handle an event
      Returns:
      this builder instance
    • build

      public LocalEventBus build()
      Build the LocalEventBus from the properties set
      Returns:
      the LocalEventBus