Methods for defining and implementing Temporal workflows
Methods for defining and implementing Temporal workflows
(await pred)(await duration pred)Efficiently parks the workflow until 'pred' evaluates to true. Re-evaluates on each state transition
Efficiently parks the workflow until 'pred' evaluates to true. Re-evaluates on each state transition
(defworkflow name params* & body)Defines a new workflow, similar to defn, expecting a 1-arity parameter list and body. Should evaluate to something
serializable, which will become available for temporal.client.core/get-result.
Arguments:
args: Passed from 'params' to temporal.client.core/start or temporal.client.core/signal-with-start(defworkflow my-workflow
[{:keys [foo]}]
...)
(let [w (create-workflow client my-workflow {:task-queue ::my-task-queue})]
(start w {:foo "bar"}))
Defines a new workflow, similar to defn, expecting a 1-arity parameter list and body. Should evaluate to something
serializable, which will become available for [[temporal.client.core/get-result]].
Arguments:
- `args`: Passed from 'params' to [[temporal.client.core/start]] or [[temporal.client.core/signal-with-start]]
```clojure
(defworkflow my-workflow
[{:keys [foo]}]
...)
(let [w (create-workflow client my-workflow {:task-queue ::my-task-queue})]
(start w {:foo "bar"}))
```(get-info)Return info about the current workflow
Return info about the current workflow
(get-version change-id min max)Used to safely perform backwards incompatible changes to workflow definitions
Used to safely perform backwards incompatible changes to workflow definitions
(register-query-handler! f)Registers a DynamicQueryHandler listener that handles queries sent to the workflow, using temporal.client.core/query.
Use inside a workflow definition with 'f' closing over the workflow state (e.g. atom) and evaluating to results in function of the workflow state and its 'query-type' and 'args' arguments.
Arguments:
f: a 2-arity function, expecting 2 arguments, evaluating to something serializable.f arguments:
query-type: keywordargs: params value or data structure(defworkflow stateful-workflow
[{:keys [init] :as args}]
(let [state (atom init)]
(register-query-handler! (fn [query-type args]
(when (= query-type :my-query)
(get-in @state [:path :to :answer]))))
;; workflow implementation
))
Registers a DynamicQueryHandler listener that handles queries sent to the workflow, using [[temporal.client.core/query]].
Use inside a workflow definition with 'f' closing over the workflow state (e.g. atom) and
evaluating to results in function of the workflow state and its 'query-type' and 'args' arguments.
Arguments:
- `f`: a 2-arity function, expecting 2 arguments, evaluating to something serializable.
`f` arguments:
- `query-type`: keyword
- `args`: params value or data structure
```clojure
(defworkflow stateful-workflow
[{:keys [init] :as args}]
(let [state (atom init)]
(register-query-handler! (fn [query-type args]
(when (= query-type :my-query)
(get-in @state [:path :to :answer]))))
;; workflow implementation
))
```(sleep duration)Efficiently parks the workflow for 'duration'
Efficiently parks the workflow for 'duration'
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 |