Class EventTransformation.SplitStep<T>

java.lang.Object
io.axoniq.framework.messaging.transformation.events.EventTransformation.SplitStep<T>
Type Parameters:
T - input payload type shared by all output mappers
Enclosing interface:
EventTransformation

public static final class EventTransformation.SplitStep<T> extends Object
Continuation of EventTransformation.split(MessageType, Class) / EventTransformation.split(MessageType, TypeReference). Pairs each produced event's MessageType with the mapper deriving its payload, so a split is declared as several 1:1 output declarations sharing one from.

The split emits exactly the declared outputs, in declaration order, every time the source is read. The produced identities are known at registration time, so a read filtered to one of them is widened back to the source and an entity sourced from a produced type observes the split. To remove an event instead of splitting it, use EventTransformation.drop(MessageType).

Unlike the single-output forms, which complete at their mapper (from(...).to(...).transform(...)) or are supplied whole (EventTransformation.rename(MessageType, MessageType), EventTransformation.drop(MessageType)), a split accumulates several outputs and is therefore finished with an explicit build().

  • Method Details

    • producing

      public EventTransformation.SplitStep<T> producing(MessageType producedType, Function<T,?> outputMapper)
      Declare one event this split produces, pairing its identity with the mapper deriving its payload from the converted input payload. Outputs are emitted in declaration order. Declaring the same MessageType more than once is allowed and emits one event per declaration.
      Parameters:
      producedType - the produced event's identity
      outputMapper - maps the input payload to the produced event's payload
      Returns:
      this builder, for further producing(...) declarations or build()
    • producing

      public EventTransformation.SplitStep<T> producing(MessageType producedType, BiFunction<T,@Nullable ProcessingContext,?> outputMapper)
      Context-aware variant of producing(MessageType, Function), for outputs that also need the ProcessingContext. The context may be null on read paths that supply none.
      Parameters:
      producedType - the produced event's identity
      outputMapper - maps the input payload and processing context to the produced event's payload
      Returns:
      this builder, for further producing(...) declarations or build()
    • build

      public EventTransformation build()
      Complete the split. A split must declare at least two outputs: with none the event would simply be removed, and with one it would be a plain 1:1 transformation, neither of which is a split.
      Returns:
      the resulting EventTransformation
      Throws:
      IllegalArgumentException - if fewer than two outputs were declared via producing(...)