Class EventBatch
java.lang.Object
io.fluxcapacitor.common.api.eventsourcing.EventBatch
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 asstoreOnly
to indicate
that the events should not be published to event handlers.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A compact metric representation of anEventBatch
, used inAppendEvents.Metric
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
getBytes()
Calculates the total number of bytes in the data across all messages within the batch.int
getSize()
Returns the number of events in this batch.boolean
isEmpty()
Returnstrue
if the batch contains no events.toMetric()
Transforms this batch into a lightweight metric representation for logging and monitoring.toString()
Returns a human-readable representation of this batch, including its aggregate ID and event count.
-
Constructor Details
-
EventBatch
public EventBatch()
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrue
if the batch contains no events. -
getSize
public int getSize()Returns the number of events in this batch. -
getBytes
public long getBytes()Calculates the total number of bytes in the data across all messages within the batch. -
toString
Returns a human-readable representation of this batch, including its aggregate ID and event count. -
toMetric
Transforms this batch into a lightweight metric representation for logging and monitoring.
-