Class WorkflowReplayer
java.lang.Object
io.temporal.testing.WorkflowReplayer
Replays a workflow given its history. Useful for backwards compatibility testing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidreplayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, TestWorkflowEnvironment testWorkflowEnvironment, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from aWorkflowExecutionHistory.static voidreplayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, io.temporal.worker.Worker worker) Replays workflow from a resource that contains a json serialized history.static voidreplayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from aWorkflowExecutionHistory.static voidreplayWorkflowExecution(File historyFile, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from a filestatic voidreplayWorkflowExecution(String jsonSerializedHistory, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from a json serialized history.static voidreplayWorkflowExecutionFromResource(String resourceName, TestWorkflowEnvironment testWorkflowEnvironment, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from a resource that contains a json serialized history.static voidreplayWorkflowExecutionFromResource(String resourceName, io.temporal.worker.Worker worker) Replays workflow from a resource that contains a json serialized history.static voidreplayWorkflowExecutionFromResource(String resourceName, Class<?> workflowClass, Class<?>... moreWorkflowClasses) Replays workflow from a resource that contains a json serialized history.static ReplayResultsreplayWorkflowExecutions(Iterable<? extends io.temporal.internal.common.WorkflowExecutionHistory> histories, boolean failFast, io.temporal.worker.Worker worker) Replays workflows provided by an iterable using an already-initialized worker.static ReplayResultsreplayWorkflowExecutions(Iterable<? extends io.temporal.internal.common.WorkflowExecutionHistory> histories, boolean failFast, Class<?>... workflowClasses) Replays workflows provided by an iterable.
-
Constructor Details
-
WorkflowReplayer
public WorkflowReplayer()
-
-
Method Details
-
replayWorkflowExecutionFromResource
public static void replayWorkflowExecutionFromResource(String resourceName, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from a resource that contains a json serialized history.- Parameters:
resourceName- name of the resourceworkflowClass- workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecutionFromResource
public static void replayWorkflowExecutionFromResource(String resourceName, io.temporal.worker.Worker worker) throws Exception Replays workflow from a resource that contains a json serialized history.- Parameters:
resourceName- name of the resource.worker- worker existing worker with the correct task queue and registered implementations.- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecutionFromResource
public static void replayWorkflowExecutionFromResource(String resourceName, TestWorkflowEnvironment testWorkflowEnvironment, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from a resource that contains a json serialized history.- Parameters:
resourceName- name of the resource.testWorkflowEnvironment- to be used to create a worker on a task queue.workflowClass- s workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(File historyFile, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from a file- Parameters:
historyFile- file that contains a json serialized history.workflowClass- s workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(String jsonSerializedHistory, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from a json serialized history. The json should be in the format:{ "workflowId": "...", "runId": "...", "events": [ ... ] }RunId must match the one used to generate the serialized history.- Parameters:
jsonSerializedHistory- string that contains the json serialized history.workflowClass- s workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from aWorkflowExecutionHistory. RunId must match the one used to generate the serialized history.- Parameters:
history- object that contains the workflow ids and the events.workflowClass- s workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, TestWorkflowEnvironment testWorkflowEnvironment, Class<?> workflowClass, Class<?>... moreWorkflowClasses) throws Exception Replays workflow from aWorkflowExecutionHistory.- Parameters:
history- object that contains the workflow ids and the events.testWorkflowEnvironment- to be used to create a worker on a task queue.workflowClass- s workflow implementation class to replaymoreWorkflowClasses- optional additional workflow implementation classes- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecution
public static void replayWorkflowExecution(io.temporal.internal.common.WorkflowExecutionHistory history, io.temporal.worker.Worker worker) throws Exception Replays workflow from a resource that contains a json serialized history.- Parameters:
history- object that contains the workflow ids and the events.worker- existing worker with registered workflow implementations.- Throws:
Exception- if replay failed for any reason.
-
replayWorkflowExecutions
public static ReplayResults replayWorkflowExecutions(Iterable<? extends io.temporal.internal.common.WorkflowExecutionHistory> histories, boolean failFast, Class<?>... workflowClasses) throws Exception Replays workflows provided by an iterable.- Parameters:
histories- The histories to be replayedfailFast- If true, throws upon the first error encountered (if any) during replay. If false, all histories will be replayed and the returned object contains information about any failures.- Returns:
- If `failFast` is false, contains any replay failures encountered.
- Throws:
Exception- If replay failed and `failFast` is true.
-
replayWorkflowExecutions
public static ReplayResults replayWorkflowExecutions(Iterable<? extends io.temporal.internal.common.WorkflowExecutionHistory> histories, boolean failFast, io.temporal.worker.Worker worker) throws Exception Replays workflows provided by an iterable using an already-initialized worker.- Parameters:
histories- The histories to be replayedfailFast- If true, throws upon the first error encountered (if any) during replay. If false, all histories will be replayed and the returned object contains information about any failures.worker- A worker which should have registered all the workflow implementations which were used to produce (or are expected to be compatible with) the provided histories.- Returns:
- If `failFast` is false, contains any replay failures encountered.
- Throws:
Exception- If replay failed and `failFast` is true.
-