Class EventMessageUtils
java.lang.Object
io.axoniq.framework.workflow.runtime.util.EventMessageUtils
Utility with factory methods for workflow event messages.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski, Stefan Dragisic
-
Method Summary
Modifier and TypeMethodDescriptionstatic EventMessagecancelledStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has been cancelled.static EventMessagecancelledStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, @Nullable Throwable cause, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has been cancelled, optionally with a cause.static EventMessagecancelledWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, @Nullable Throwable cause, EventNameCustomizer customizer) Creates a cancelled event for a wait-for-event step.static EventMessagecancelledWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, @Nullable Throwable cause, VersionedType workflowDefinitionId, EventNameCustomizer customizer) static EventMessagecancelledWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has been cancelled.static EventMessagecompletedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> result, @Nullable String resultPayloadReducerName, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has completed.static EventMessagecompletedWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> result, @Nullable String resultPayloadReducerName, EventNameCustomizer customizer) Creates a completed event for a wait-for-event step.static EventMessagecompletedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has completed successfully.static EventMessagefailedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, Exception exception, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has failed.static EventMessagefailStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Throwable exception, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has failed.static EventMessageretryingStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, StepRetryInfo retryInfo, EventNameCustomizer customizer) Creates a new event message stating that a workflow step is retrying.static EventMessageretryStartedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, StepRetryInfo retryInfo, EventNameCustomizer customizer) Creates a new event message stating that a retry attempt of a workflow step has started.static EventMessagestartedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> local, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has started.static EventMessagestartedWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> local, EventNameCustomizer customizer) Creates a new started event for a wait-for-event step.static EventMessagestartedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has started.static EventMessagetimeoutStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Instant time, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has timed out.static EventMessagetimeoutWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Instant time, EventNameCustomizer customizer) Creates a timed-out event for a wait-for-event step.static EventMessagetimeoutWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, Instant time, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has timed out.static EventMessageversionMigrationStep(WorkflowEventPublicationContext workflowEventPublicationContext, String changeId, String version, EventNameCustomizer customizer) Creates a new event message recording a migration step for the givenchangeId.static Predicate<EventMessage> workflowIdFilter(String workflowId) Creates a filter predicate for event messages based on the workflow ID.
-
Method Details
-
workflowIdFilter
Creates a filter predicate for event messages based on the workflow ID.- Parameters:
workflowId- ID of the workflow.- Returns:
- predicate filtering event messages by workflow ID.
-
startedWorkflow
public static EventMessage startedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has started.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.workflowName- name of the workflow.customizer- event name customizer.- Returns:
- event message.
-
completedWorkflow
public static EventMessage completedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has completed successfully.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.workflowName- name of the workflow.customizer- event name customizer.- Returns:
- event message.
-
failedWorkflow
public static EventMessage failedWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, Exception exception, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has failed.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication contextworkflowName- name of the workflowexception- exception that caused the failureworkflowDefinitionId- workflow definition identitycustomizer- event name customizer- Returns:
- event message.
-
timeoutWorkflow
public static EventMessage timeoutWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, Instant time, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has timed out.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication contextworkflowName- name of the workflowtime- time when the timeout occurredworkflowDefinitionId- workflow definition identitycustomizer- event name customizer- Returns:
- event message.
-
cancelledWorkflow
public static EventMessage cancelledWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, VersionedType workflowDefinitionId, EventNameCustomizer customizer) Creates a new event message stating that a workflow has been cancelled.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication contextworkflowName- name of the workflowworkflowDefinitionId- workflow definition identitycustomizer- event name customizer- Returns:
- event message.
-
cancelledWorkflow
public static EventMessage cancelledWorkflow(WorkflowEventPublicationContext workflowEventPublicationContext, String workflowName, @Nullable Throwable cause, VersionedType workflowDefinitionId, EventNameCustomizer customizer) -
startedStep
public static EventMessage startedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> local, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has started.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.local- local payload for the step.customizer- event name customizer.- Returns:
- event message.
-
startedWaitForEventStep
public static EventMessage startedWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> local, EventNameCustomizer customizer) Creates a new started event for a wait-for-event step.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication contextstepName- name of the steplocal- local datacustomizer- customizer for event name
-
completedStep
public static EventMessage completedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> result, @Nullable String resultPayloadReducerName, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has completed.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.result- result of the step.resultPayloadReducerName- name of the result payload reducer, ornullif no reducer is used, seeLocalOnlyPayloadReducer,GlobalOnlyPayloadReducer,CombineGlobalAndLocalPayloadReducercustomizer- event name customizer.- Returns:
- event message.
-
completedWaitForEventStep
public static EventMessage completedWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Map<String, @Nullable Object> result, @Nullable String resultPayloadReducerName, EventNameCustomizer customizer) Creates a completed event for a wait-for-event step. -
failStep
public static EventMessage failStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Throwable exception, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has failed.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.exception- exception that caused the step failure.customizer- event name customizer.- Returns:
- event message.
-
cancelledStep
public static EventMessage cancelledStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has been cancelled.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.customizer- event name customizer.- Returns:
- event message.
-
cancelledStep
public static EventMessage cancelledStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, @Nullable Throwable cause, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has been cancelled, optionally with a cause.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.cause- the cause of the cancellation, ornull.customizer- event name customizer.- Returns:
- event message.
-
cancelledWaitForEventStep
public static EventMessage cancelledWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, @Nullable Throwable cause, EventNameCustomizer customizer) Creates a cancelled event for a wait-for-event step. -
retryingStep
public static EventMessage retryingStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, StepRetryInfo retryInfo, EventNameCustomizer customizer) Creates a new event message stating that a workflow step is retrying.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.retryInfo- retry information payload.customizer- event name customizer.- Returns:
- event message.
-
retryStartedStep
public static EventMessage retryStartedStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, StepRetryInfo retryInfo, EventNameCustomizer customizer) Creates a new event message stating that a retry attempt of a workflow step has started.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication contextstepName- the name of the retry started stepretryInfo- retry information payload,attemptis the attempt being startedcustomizer- event name customizer- Returns:
- the retry started event message
-
timeoutStep
public static EventMessage timeoutStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Instant time, EventNameCustomizer customizer) Creates a new event message stating that a workflow step has timed out.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.stepName- name of the step.time- time when the timeout occurred.customizer- event name customizer.- Returns:
- event message.
-
timeoutWaitForEventStep
public static EventMessage timeoutWaitForEventStep(WorkflowEventPublicationContext workflowEventPublicationContext, String stepName, Instant time, EventNameCustomizer customizer) Creates a timed-out event for a wait-for-event step. -
versionMigrationStep
public static EventMessage versionMigrationStep(WorkflowEventPublicationContext workflowEventPublicationContext, String changeId, String version, EventNameCustomizer customizer) Creates a new event message recording a migration step for the givenchangeId. The wire-level event name comes fromEventNameCustomizer.versionMigrationEventName(String, Map)— by default<changeId>.Versioned(e.g.Payment-redesign.Versioned). TheMessageType.version()on the resulting event reflects the workflow's new version. The event is published as aStepStatus.COMPLETEDstep event withversionChangeId+versionmigration metadata keys; theversionChangeIdpresence identifies it as a migration step.- Parameters:
workflowEventPublicationContext- read-only workflow event-publication context.changeId- developer-chosen identifier of the code change.version- the new workflow version being recorded.customizer- event name customizer.- Returns:
- event message.
-