Class MessageBatch

java.lang.Object
io.fluxcapacitor.common.api.tracking.MessageBatch

public class MessageBatch extends Object
Represents a batch of messages retrieved from the message store for a specific segment range.

A message batch contains a list of SerializedMessage instances and metadata such as the last known index and the Position of the consumer when this batch was read.

The segment and position fields are especially relevant when the tracker operates with ignoreSegment=true, meaning segment filtering is handled on the client side. In such cases, the platform returns all potentially matching messages, and the client uses the Position and segment range to determine which messages are truly relevant for processing.

  • Constructor Details

    • MessageBatch

      public MessageBatch()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Indicates whether this message batch is empty.
    • getSize

      public int getSize()
      Returns the number of messages contained in this batch.
    • getBytes

      public long getBytes()
      Calculates the total number of bytes in the data across all messages within the batch.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toMetric

      public MessageBatch.Metric toMetric()
      Converts this batch into a compact, serializable representation for monitoring purposes.
      Returns:
      a MessageBatch.Metric representing key metadata about this batch