Liking cljdoc? Tell your friends :D

temporal.testing.replayer

Methods for replay-testing Temporal workflows against their persisted event histories.

Methods for replay-testing Temporal workflows against their persisted event histories.
raw docstring

closeclj

(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)
```
sourceraw docstring

createclj

(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:

(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]]
sourceraw docstring

replayclj

(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:

ValueDescriptionType
replayerHandle returned from createReplayer
historyWorkflow execution history to replayWorkflowExecutionHistory
(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]]
sourceraw docstring

replay-allclj

(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:

ValueDescriptionType
replayerHandle returned from createReplayer
historiesSequence of workflow histories to replayIterable of WorkflowExecutionHistory
optsOptions 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]]
sourceraw docstring

replay-historyclj

(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:

ValueDescriptionTypeDefault
historyWorkflow execution history to replayWorkflowExecutionHistory
optsOptions map forwarded to createmap{}
(replay-history (history/from-resource "histories/order-workflow.json"))
(replay-history h {:data-converter my-converter})

See also create, replay

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]]
sourceraw docstring

replayer-optionsclj

Options map accepted by create.

KeyDescriptionTypeDefault
:dispatchExplicit workflow/activity dispatch tablemap with :workflows/:activities keysauto-dispatch
:data-converterCustom data converter for decoding history payloadsDataConverterdefault
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 |
sourceraw docstring

synchronized-stopclj

(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)
```
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close