Class EventBatch

java.lang.Object
io.fluxzero.common.api.eventsourcing.EventBatch

public class EventBatch extends Object
Represents a batch of serialized events for a specific aggregate.

An EventBatch groups one or more SerializedMessage instances that belong to the same aggregate. Batches are typically appended atomically to the event store and processed in order.

This class is used within AppendEvents to persist updates to aggregates in event-sourced systems.

Usage

- All events in a batch must refer to the same aggregate ID. - A batch may be marked as storeOnly to indicate that the events should not be published to event handlers.
See Also:
  • Constructor Details

    • EventBatch

      public EventBatch()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns true if the batch contains no events.
    • getSize

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

      public long getBytes()
      Calculates the complete serialized size of all messages within the batch.
    • toString

      public String toString()
      Returns a human-readable representation of this batch, including its aggregate ID and event count.
      Overrides:
      toString in class Object
    • toMetric

      public EventBatch.Metric toMetric()
      Transforms this batch into a lightweight metric representation for logging and monitoring.