Class AppendEvents

java.lang.Object
io.fluxcapacitor.common.api.Request
io.fluxcapacitor.common.api.Command
io.fluxcapacitor.common.api.eventsourcing.AppendEvents
All Implemented Interfaces:
JsonType

public class AppendEvents extends Command
Command used to append one or more event batches to the event store.

Each EventBatch corresponds to a single aggregate instance and contains a list of serialized events along with metadata such as the aggregate ID and the current sequence number.

This command is typically sent by a client when applying updates to aggregates in an event-sourced system. Events in the same batch are stored atomically and will be assigned sequential positions in the event log.

Routing

The command is routed based on the aggregate ID of the first batch. If multiple batches are included, they should ideally refer to the same aggregate or be routed consistently by design.
See Also:
  • Constructor Details

    • AppendEvents

      public AppendEvents()
  • Method Details

    • toString

      public String toString()
      Returns a human-readable description of the operation.
      Overrides:
      toString in class Object
    • routingKey

      public String routingKey()
      Returns the routing key used to partition the command, based on the first batch’s aggregate ID.
      Overrides:
      routingKey in class Command
      Returns:
      a routing key string, or null if not specified
    • toMetric

      public AppendEvents.Metric toMetric()
      Converts this command to a metric-friendly representation for logging and monitoring.
      Returns:
      a safe and compact object suitable for serialization to the metrics log