Liking cljdoc? Tell your friends :D

temporal.testing.history

Methods for loading, capturing, and serializing Temporal workflow execution histories for use in replay testing.

Methods for loading, capturing, and serializing Temporal workflow execution histories for use in replay testing.
raw docstring

->jsonclj

(->json history)
(->json history pretty-print?)

Serializes a WorkflowExecutionHistory to a JSON string.

Arguments:

ValueDescriptionTypeDefault
historyThe workflow execution history to serializeWorkflowExecutionHistory
pretty-print?Whether to format JSON output with indentationbooleantrue
(spit "order.json" (->json history))
(spit "order.json" (->json history false))

See also from-json, fetch

Serializes a `WorkflowExecutionHistory` to a JSON string.

Arguments:

| Value           | Description                                             | Type                     | Default |
| --------------- | ------------------------------------------------------- | ------------------------ | ------- |
| `history`       | The workflow execution history to serialize             | WorkflowExecutionHistory |         |
| `pretty-print?` | Whether to format JSON output with indentation          | boolean                  | `true`  |

```clojure
(spit "order.json" (->json history))
(spit "order.json" (->json history false))
```

See also [[from-json]], [[fetch]]
sourceraw docstring

fetchclj

(fetch client workflow-id)

Fetches a workflow execution history from a live Temporal server.

Arguments:

ValueDescriptionType
clientWorkflowClient from temporal.client.core/create-clientWorkflowClient
workflow-idID of the workflow whose history to fetchString
(let [h (fetch client "workflow-id-123")]
  (spit "test/resources/histories/order.json" (->json h)))

See also from-json, from-file, from-resource, ->json

Fetches a workflow execution history from a live Temporal server.

Arguments:

| Value         | Description                                                    | Type                                                    |
| ------------- | -------------------------------------------------------------- | ------------------------------------------------------- |
| `client`      | WorkflowClient from [[temporal.client.core/create-client]]     | WorkflowClient                                          |
| `workflow-id` | ID of the workflow whose history to fetch                      | String                                                  |

```clojure
(let [h (fetch client "workflow-id-123")]
  (spit "test/resources/histories/order.json" (->json h)))
```

See also [[from-json]], [[from-file]], [[from-resource]], [[->json]]
sourceraw docstring

from-fileclj

(from-file file)

Reads a workflow execution history from a file.

Accepts a string path, java.io.File, or java.nio.file.Path.

Arguments:

ValueDescriptionType
filePath to a JSON file containing the workflow historyString, java.io.File, or java.nio.file.Path
(from-file "test/resources/histories/order.json")
(from-file (clojure.java.io/file "test/resources/histories/order.json"))

See also from-json, from-resource, fetch, ->json

Reads a workflow execution history from a file.

Accepts a string path, `java.io.File`, or `java.nio.file.Path`.

Arguments:

| Value  | Description                                           | Type                                             |
| ------ | ----------------------------------------------------- | ------------------------------------------------ |
| `file` | Path to a JSON file containing the workflow history   | String, `java.io.File`, or `java.nio.file.Path` |

```clojure
(from-file "test/resources/histories/order.json")
(from-file (clojure.java.io/file "test/resources/histories/order.json"))
```

See also [[from-json]], [[from-resource]], [[fetch]], [[->json]]
sourceraw docstring

from-jsonclj

(from-json json)
(from-json json workflow-id)

Parses a JSON string into a WorkflowExecutionHistory.

Arguments:

ValueDescriptionTypeDefault
jsonJSON string containing the serialized workflow execution historyString
workflow-idOptional workflow ID override, replaces any ID embedded in JSONStringnil
(from-json "{...history json...}")
(from-json "{...history json...}" "my-workflow-id")

See also from-file, from-resource, fetch, ->json

Parses a JSON string into a `WorkflowExecutionHistory`.

Arguments:

| Value         | Description                                                      | Type   | Default |
| ------------- | ---------------------------------------------------------------- | ------ | ------- |
| `json`        | JSON string containing the serialized workflow execution history  | String |         |
| `workflow-id` | Optional workflow ID override, replaces any ID embedded in JSON  | String | nil     |

```clojure
(from-json "{...history json...}")
(from-json "{...history json...}" "my-workflow-id")
```

See also [[from-file]], [[from-resource]], [[fetch]], [[->json]]
sourceraw docstring

from-resourceclj

(from-resource name)

Reads a workflow execution history from a classpath resource.

Throws ex-info with {:resource name} if the resource is not found on the classpath.

Arguments:

ValueDescriptionType
nameClasspath resource name for the JSON-serialized workflow historyString
(from-resource "histories/order-workflow.json")

See also from-json, from-file, fetch, ->json

Reads a workflow execution history from a classpath resource.

Throws `ex-info` with `{:resource name}` if the resource is not found on the classpath.

Arguments:

| Value  | Description                                                        | Type   |
| ------ | ------------------------------------------------------------------ | ------ |
| `name` | Classpath resource name for the JSON-serialized workflow history   | String |

```clojure
(from-resource "histories/order-workflow.json")
```

See also [[from-json]], [[from-file]], [[fetch]], [[->json]]
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