Class DefaultEventNameCustomizer

java.lang.Object
io.axoniq.framework.workflow.runtime.execution.DefaultEventNameCustomizer
All Implemented Interfaces:
EventNameCustomizer

public class DefaultEventNameCustomizer extends Object implements EventNameCustomizer
Default implementation of EventNameCustomizer that builds event names from a base name and status suffix.
Since:
5.4.0
Author:
Stefan Dragisic, Simon Zambrovski
  • Method Details

    • baseName

      public DefaultEventNameCustomizer baseName(String baseName)
      Sets the base name for the step.
      Parameters:
      baseName - base name of the step.
      Returns:
      current instance for fluent API.
    • workflowBaseName

      public DefaultEventNameCustomizer workflowBaseName(String workflowBaseName)
      Sets the workflow base name.
      Parameters:
      workflowBaseName - base name for the workflow.
      Returns:
      current instance for fluent API.
    • namespace

      public DefaultEventNameCustomizer namespace(String namespace)
      Sets the namespace for the events.
      Parameters:
      namespace - namespace for the events.
      Returns:
      current instance for fluent API.
    • appendToBaseName

      public DefaultEventNameCustomizer appendToBaseName(boolean appendToBaseName)
      Sets the flag controlling if the step name is a suffix or is the entire name of the event.
      Parameters:
      appendToBaseName - if true, the step name is considered as suffix.
      Returns:
      current instance for fluent API.
    • capitalizeSimpleName

      public DefaultEventNameCustomizer capitalizeSimpleName(boolean capitalizeSimpleName)
      Sets the flag controlling if the simple name of the step is capitalized.
      Parameters:
      capitalizeSimpleName - if true, the first name of the status is capitalized.
      Returns:
      current instance for fluent API.
    • stepRetrying

      public DefaultEventNameCustomizer stepRetrying(String retrying)
      Sets the step status suffix for retrying status.
      Parameters:
      retrying - suffix appended to the stap base name if it is in retrying status.
      Returns:
      current instance for fluent API.
    • stepRetryStarted

      public DefaultEventNameCustomizer stepRetryStarted(String retryStarted)
      Sets the step status suffix for retry started status.
      Parameters:
      retryStarted - suffix appended to the step base name when a retry attempt starts
      Returns:
      current instance for fluent API
    • stepCompleted

      public DefaultEventNameCustomizer stepCompleted(String completed)
      Sets the step status suffix for completed status.
      Parameters:
      completed - suffix appended to the stap base name if it is in completed status.
      Returns:
      current instance for fluent API.
    • stepStarted

      public DefaultEventNameCustomizer stepStarted(String started)
      Sets the step status suffix for started status.
      Parameters:
      started - suffix appended to the stap base name if it is in started status.
      Returns:
      current instance for fluent API.
    • stepTimedOut

      public DefaultEventNameCustomizer stepTimedOut(String timedOut)
      Sets the step status suffix for timed-out status.
      Parameters:
      timedOut - suffix appended to the stap base name if it is in timed-out status.
      Returns:
      current instance for fluent API.
    • stepFailed

      public DefaultEventNameCustomizer stepFailed(String failed)
      Sets the step status suffix for failed status.
      Parameters:
      failed - suffix appended to the stap base name if it is in failed status.
      Returns:
      current instance for fluent API.
    • stepCancelled

      public DefaultEventNameCustomizer stepCancelled(String cancelled)
      Sets the step status suffix for cancelled status.
      Parameters:
      cancelled - suffix appended to the stap base name if it is in cancelled status.
      Returns:
      current instance for fluent API.
    • workflowCompleted

      public DefaultEventNameCustomizer workflowCompleted(String completed)
      Sets the workflow status suffix for completed status.
      Parameters:
      completed - suffix appended to the workflow base name if it is in completed status.
      Returns:
      current instance for fluent API.
    • workflowStarted

      public DefaultEventNameCustomizer workflowStarted(String started)
      Sets the workflow status suffix for started status.
      Parameters:
      started - suffix appended to the workflow base name if it is in started status.
      Returns:
      current instance for fluent API.
    • workflowTimedOut

      public DefaultEventNameCustomizer workflowTimedOut(String timedOut)
      Sets the workflow status suffix for timed-out status.
      Parameters:
      timedOut - suffix appended to the workflow base name if it is in timed-out status.
      Returns:
      current instance for fluent API.
    • workflowFailed

      public DefaultEventNameCustomizer workflowFailed(String failed)
      Sets the workflow status suffix for failed status.
      Parameters:
      failed - suffix appended to the workflow base name if it is in failed status.
      Returns:
      current instance for fluent API.
    • workflowCancelled

      public DefaultEventNameCustomizer workflowCancelled(String cancelled)
      Sets the workflow status suffix for cancelled status.
      Parameters:
      cancelled - suffix appended to the workflow base name if it is in cancelled status.
      Returns:
      current instance for fluent API.
    • workflowVersioned

      public DefaultEventNameCustomizer workflowVersioned(String versioned)
      Sets the suffix appended to the changeId for version-marker events produced by ctx.migrateVersion(changeId, newVersion). Defaults to ".Versioned" so the wire-level event name is e.g. Payment-redesign.Versioned.
      Parameters:
      versioned - non-null suffix appended to the changeId for version-marker events.
      Returns:
      current instance for fluent API.
    • payloadCustomization

      Sets the function to customize step based on the payload.
      Parameters:
      payloadCustomization - function to customize step based on the payload.
      Returns:
      current instance for fluent API.
    • forStepInheritance

      public EventNameCustomizer forStepInheritance()
      Description copied from interface: EventNameCustomizer
      Returns a customized event name based on the provided step name, parameters, and workflow status.
      Specified by:
      forStepInheritance in interface EventNameCustomizer
      Returns:
      event name customizer that will use the namespace of the parent step.
    • getEventName

      public QualifiedName getEventName(String stepName, Map<String,@Nullable Object> parameters, StepStatus stepStatus)
      Description copied from interface: EventNameCustomizer
      Returns a customized event name based on the provided step name, parameters, and step status.
      Specified by:
      getEventName in interface EventNameCustomizer
      Parameters:
      stepName - the name of the step
      parameters - the parameters associated with the step
      stepStatus - the status of the step
      Returns:
      the customized event name.
    • getEventName

      public QualifiedName getEventName(String stepName, Map<String,@Nullable Object> parameters, WorkflowStatus workflowStatus)
      Description copied from interface: EventNameCustomizer
      Returns a customized event name based on the provided step name, parameters, and workflow status.
      Specified by:
      getEventName in interface EventNameCustomizer
      Parameters:
      stepName - the name of the step
      parameters - the parameters associated with the step
      workflowStatus - the status of the step
      Returns:
      the customized event name.
    • versionMigrationEventName

      public QualifiedName versionMigrationEventName(String changeId, Map<String,@Nullable Object> parameters)
      Description copied from interface: EventNameCustomizer
      Returns a customized event name for a migration step produced by ctx.migrateVersion(changeId, newVersion). The changeId is the semantic anchor; the resulting wire-level name describes what changed (default suffix .Versioned, e.g. Payment-redesign.Versioned).

      The interface default derives a name from EventNameCustomizer.getEventName(String, Map, StepStatus) with StepStatus.COMPLETED and appends a .Versioned marker so a migration event stays distinguishable on the wire from an ordinary completed-step event (which matters in an event-sourced engine — colliding names risk replay drift).

      invalid reference
      DefaultEventNameCustomizer
      overrides this with the canonical <changeId>.Versioned form; custom customizers that do not override it still get a distinct name from this default.
      Specified by:
      versionMigrationEventName in interface EventNameCustomizer
      Parameters:
      changeId - developer-chosen identifier of the code change.
      parameters - parameters associated with the event.
      Returns:
      the customized event name.