Class Batcher.Options

java.lang.Object
com.salesforce.multicloudj.pubsub.batcher.Batcher.Options
Enclosing class:
Batcher<T>

public static class Batcher.Options extends Object
Configuration options that govern how the Batcher behaves. All limits are inclusive and validated by the Batcher where relevant.

maxHandlers - Maximum number of concurrent handler threads that may be actively processing batches at any given time. Must be >= 1 and determines the size of the underlying executor. minBatchSize - Minimum number of items required before a batch is dispatched during normal operation. If fewer than this number are pending, the batcher waits for more items unless it is shutting down (in which case remaining items are flushed regardless). maxBatchSize - Hard cap on the number of items allowed in a single batch. A value of 0 disables this bound. When both maxBatchSize and maxBatchByteSize are set, whichever limit is reached first finalises the batch. maxBatchByteSize - Hard cap on the cumulative byte size of the items in a single batch, as reported by Batcher.SizableItem.getByteSize(). A value of 0 disables this bound.

  • Constructor Details

    • Options

      public Options()
  • Method Details

    • getMaxHandlers

      public int getMaxHandlers()
      Maximum number of concurrent handler threads
    • getMinBatchSize

      public int getMinBatchSize()
      Minimum number of items required to form a batch
    • getMaxBatchSize

      public int getMaxBatchSize()
      Maximum number of items in a single batch (0 = unlimited)
    • getMaxBatchByteSize

      public int getMaxBatchByteSize()
      Maximum total byte size of a batch (0 = unlimited)
    • setMaxHandlers

      public Batcher.Options setMaxHandlers(int maxHandlers)
      Maximum number of concurrent handler threads
      Returns:
      this.
    • setMinBatchSize

      public Batcher.Options setMinBatchSize(int minBatchSize)
      Minimum number of items required to form a batch
      Returns:
      this.
    • setMaxBatchSize

      public Batcher.Options setMaxBatchSize(int maxBatchSize)
      Maximum number of items in a single batch (0 = unlimited)
      Returns:
      this.
    • setMaxBatchByteSize

      public Batcher.Options setMaxBatchByteSize(int maxBatchByteSize)
      Maximum total byte size of a batch (0 = unlimited)
      Returns:
      this.