Class DefaultEventNameCustomizer
java.lang.Object
io.axoniq.framework.workflow.runtime.execution.DefaultEventNameCustomizer
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forDefaultEventNameCustomizer.static final recordData class containing information for payload customization. -
Method Summary
Modifier and TypeMethodDescriptionappendToBaseName(boolean appendToBaseName) Sets the flag controlling if the step name is a suffix or is the entire name of the event.Sets the base name for the step.capitalizeSimpleName(boolean capitalizeSimpleName) Sets the flag controlling if the simple name of the step is capitalized.Returns a customized event name based on the provided step name, parameters, and workflow status.getEventName(String stepName, Map<String, @Nullable Object> parameters, StepStatus stepStatus) Returns a customized event name based on the provided step name, parameters, and step status.getEventName(String stepName, Map<String, @Nullable Object> parameters, WorkflowStatus workflowStatus) Returns a customized event name based on the provided step name, parameters, and workflow status.Sets the namespace for the events.payloadCustomization(Function<DefaultEventNameCustomizer.PayloadCustomization, QualifiedName> payloadCustomization) Sets the function to customize step based on the payload.stepCancelled(String cancelled) Sets the step status suffix for cancelled status.stepCompleted(String completed) Sets the step status suffix for completed status.stepFailed(String failed) Sets the step status suffix for failed status.stepRetrying(String retrying) Sets the step status suffix for retrying status.stepRetryStarted(String retryStarted) Sets the step status suffix for retry started status.stepStarted(String started) Sets the step status suffix for started status.stepTimedOut(String timedOut) Sets the step status suffix for timed-out status.versionMigrationEventName(String changeId, Map<String, @Nullable Object> parameters) Returns a customized event name for a migration step produced byctx.migrateVersion(changeId, newVersion).workflowBaseName(String workflowBaseName) Sets the workflow base name.workflowCancelled(String cancelled) Sets the workflow status suffix for cancelled status.workflowCompleted(String completed) Sets the workflow status suffix for completed status.workflowFailed(String failed) Sets the workflow status suffix for failed status.workflowStarted(String started) Sets the workflow status suffix for started status.workflowTimedOut(String timedOut) Sets the workflow status suffix for timed-out status.workflowVersioned(String versioned) Sets the suffix appended to thechangeIdfor version-marker events produced byctx.migrateVersion(changeId, newVersion).
-
Method Details
-
baseName
Sets the base name for the step.- Parameters:
baseName- base name of the step.- Returns:
- current instance for fluent API.
-
workflowBaseName
Sets the workflow base name.- Parameters:
workflowBaseName- base name for the workflow.- Returns:
- current instance for fluent API.
-
namespace
Sets the namespace for the events.- Parameters:
namespace- namespace for the events.- Returns:
- current instance for fluent API.
-
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sets the suffix appended to thechangeIdfor version-marker events produced byctx.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 thechangeIdfor version-marker events.- Returns:
- current instance for fluent API.
-
payloadCustomization
public DefaultEventNameCustomizer payloadCustomization(Function<DefaultEventNameCustomizer.PayloadCustomization, QualifiedName> 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
Description copied from interface:EventNameCustomizerReturns a customized event name based on the provided step name, parameters, and workflow status.- Specified by:
forStepInheritancein interfaceEventNameCustomizer- 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:EventNameCustomizerReturns a customized event name based on the provided step name, parameters, and step status.- Specified by:
getEventNamein interfaceEventNameCustomizer- Parameters:
stepName- the name of the stepparameters- the parameters associated with the stepstepStatus- 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:EventNameCustomizerReturns a customized event name based on the provided step name, parameters, and workflow status.- Specified by:
getEventNamein interfaceEventNameCustomizer- Parameters:
stepName- the name of the stepparameters- the parameters associated with the stepworkflowStatus- 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:EventNameCustomizerReturns a customized event name for a migration step produced byctx.migrateVersion(changeId, newVersion). ThechangeIdis 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)withStepStatus.COMPLETEDand appends a.Versionedmarker 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).overrides this with the canonicalinvalid reference
DefaultEventNameCustomizer<changeId>.Versionedform; custom customizers that do not override it still get a distinct name from this default.- Specified by:
versionMigrationEventNamein interfaceEventNameCustomizer- Parameters:
changeId- developer-chosen identifier of the code change.parameters- parameters associated with the event.- Returns:
- the customized event name.
-