Methods for defining and invoking activity tasks
Methods for defining and invoking activity tasks
(defactivity name params* & body)Defines a new activity, similar to defn, expecting a 2-arity parameter list and body. Should evaluate to something
serializable, which will be available to the invoke caller.
Arguments:
ctx: Context passed through from temporal.client.worker/startargs: Passed from 'params' of invoke(defactivity greet-activity
[ctx {:keys [name] :as args}]
(str "Hi, " name))
Defines a new activity, similar to defn, expecting a 2-arity parameter list and body. Should evaluate to something
serializable, which will be available to the [[invoke]] caller.
Arguments:
- `ctx`: Context passed through from [[temporal.client.worker/start]]
- `args`: Passed from 'params' of [[invoke]]
```clojure
(defactivity greet-activity
[ctx {:keys [name] :as args}]
(str "Hi, " name))
```(invoke activity params)(invoke activity params options)Invokes 'activity' with 'params' from within a workflow context. Returns a promise that when derefed will resolve to the evaluation of the defactivity once the activity concludes.
(defactivity my-activity
[ctx {:keys [foo] :as args}]
...)
(invoke my-activity {:foo "bar"} {:start-to-close-timeout (Duration/ofSeconds 3))
Invokes 'activity' with 'params' from within a workflow context. Returns a promise that when derefed will resolve to
the evaluation of the defactivity once the activity concludes.
```clojure
(defactivity my-activity
[ctx {:keys [foo] :as args}]
...)
(invoke my-activity {:foo "bar"} {:start-to-close-timeout (Duration/ofSeconds 3))
```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 |