Methods for replay-testing Temporal workflows against their persisted event histories.
Methods for replay-testing Temporal workflows against their persisted event histories.
(close replayer)Shuts down the replayer environment asynchronously. Does not wait for shutdown to complete.
For coordinated shutdown, see synchronized-stop.
(close replayer)
Shuts down the replayer environment asynchronously. Does not wait for shutdown to complete. For coordinated shutdown, see [[synchronized-stop]]. ```clojure (close replayer) ```
(create)(create {:keys [data-converter dispatch]})Creates a reusable replayer handle backed by a TestWorkflowEnvironment with dynamic dispatch registered.
The returned value implements java.io.Closeable and may be used with with-open.
Arguments:
options: Configuration map (See replayer-options)(with-open [r (create {:data-converter my-converter})]
(replay r (history/from-resource "histories/order.json")))
See also replay, replay-all, replay-history
Creates a reusable replayer handle backed by a `TestWorkflowEnvironment` with dynamic dispatch registered.
The returned value implements `java.io.Closeable` and may be used with `with-open`.
Arguments:
- `options`: Configuration map (See [[replayer-options]])
```clojure
(with-open [r (create {:data-converter my-converter})]
(replay r (history/from-resource "histories/order.json")))
```
See also [[replay]], [[replay-all]], [[replay-history]](replay replayer history)Replays a single workflow execution history against the registered workflows.
Throws ex-info with {:workflow-id ... :cause e} if the history does not replay cleanly
(i.e. a non-determinism error is detected).
Arguments:
| Value | Description | Type |
|---|---|---|
replayer | Handle returned from create | Replayer |
history | Workflow execution history to replay | WorkflowExecutionHistory |
(with-open [r (create)]
(replay r (history/from-resource "histories/order.json")))
See also replay-all, replay-history
Replays a single workflow execution history against the registered workflows.
Throws `ex-info` with `{:workflow-id ... :cause e}` if the history does not replay cleanly
(i.e. a non-determinism error is detected).
Arguments:
| Value | Description | Type |
| ----------- | -------------------------------------- | ------------------------ |
| `replayer` | Handle returned from [[create]] | Replayer |
| `history` | Workflow execution history to replay | WorkflowExecutionHistory |
```clojure
(with-open [r (create)]
(replay r (history/from-resource "histories/order.json")))
```
See also [[replay-all]], [[replay-history]](replay-all replayer histories)(replay-all replayer histories {:keys [fail-fast?] :or {fail-fast? false}})Replays multiple workflow execution histories against the registered workflows.
Returns a map {:total n :failures [{:workflow-id "..." :error #<Exception>} ...]}.
:total is the count of all input histories; :failures contains one entry per non-determinism error.
Arguments:
| Value | Description | Type |
|---|---|---|
replayer | Handle returned from create | Replayer |
histories | Sequence of workflow histories to replay | Iterable of WorkflowExecutionHistory |
opts | Options map {:fail-fast? bool} — stop on first failure when true. When :fail-fast? true and a failure occurs, throws ex-info with {:cause e} rather than returning a result map. | map |
(with-open [r (create)]
(let [{:keys [total failures]} (replay-all r histories {:fail-fast? false})]
(when (seq failures)
(throw (ex-info "Non-determinism detected" {:failures failures})))))
See also replay, replay-history
Replays multiple workflow execution histories against the registered workflows.
Returns a map `{:total n :failures [{:workflow-id "..." :error #<Exception>} ...]}`.
`:total` is the count of all input histories; `:failures` contains one entry per non-determinism error.
Arguments:
| Value | Description | Type |
| ----------- | -------------------------------------------------------------- | ------------------------------ |
| `replayer` | Handle returned from [[create]] | Replayer |
| `histories` | Sequence of workflow histories to replay | Iterable of WorkflowExecutionHistory |
| `opts` | Options map `{:fail-fast? bool}` — stop on first failure when `true`. When `:fail-fast? true` and a failure occurs, throws `ex-info` with `{:cause e}` rather than returning a result map. | map |
```clojure
(with-open [r (create)]
(let [{:keys [total failures]} (replay-all r histories {:fail-fast? false})]
(when (seq failures)
(throw (ex-info "Non-determinism detected" {:failures failures})))))
```
See also [[replay]], [[replay-history]](replay-history history)(replay-history history opts)One-shot convenience function: creates a replayer, replays a single history, then closes.
Throws ex-info with {:workflow-id ... :cause e} on non-determinism.
Arguments:
| Value | Description | Type | Default |
|---|---|---|---|
history | Workflow execution history to replay | WorkflowExecutionHistory | |
opts | Options map forwarded to create | map | {} |
(replay-history (history/from-resource "histories/order-workflow.json"))
(replay-history h {:data-converter my-converter})
One-shot convenience function: creates a replayer, replays a single history, then closes.
Throws `ex-info` with `{:workflow-id ... :cause e}` on non-determinism.
Arguments:
| Value | Description | Type | Default |
| --------- | ------------------------------------------ | ------------------------ | ------- |
| `history` | Workflow execution history to replay | WorkflowExecutionHistory | |
| `opts` | Options map forwarded to [[create]] | map | `{}` |
```clojure
(replay-history (history/from-resource "histories/order-workflow.json"))
(replay-history h {:data-converter my-converter})
```
See also [[create]], [[replay]]Options map accepted by create.
| Key | Description | Type | Default |
|---|---|---|---|
:dispatch | Explicit workflow/activity dispatch table | map with :workflows/:activities keys | auto-dispatch |
:data-converter | Custom data converter for decoding history payloads | DataConverter | default |
Options map accepted by [[create]]. | Key | Description | Type | Default | | ------------------ | ---------------------------------------------------- | ------------------------------ | ------- | | `:dispatch` | Explicit workflow/activity dispatch table | map with `:workflows`/`:activities` keys | auto-dispatch | | `:data-converter` | Custom data converter for decoding history payloads | [DataConverter](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/common/converter/DataConverter.html) | default |
(synchronized-stop replayer)Shuts down the replayer environment and blocks until it has fully stopped.
For async shutdown, see close.
(synchronized-stop replayer)
Shuts down the replayer environment and blocks until it has fully stopped. For async shutdown, see [[close]]. ```clojure (synchronized-stop replayer) ```
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |