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 with prn-str, which will be available to the invoke
caller.
Arguments:
ctx
: Context passed through from temporal.client.worker/start
args
: 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 with [prn-str](https://clojuredocs.org/clojure.core/prn-str), 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 is a website building & hosting documentation for Clojure/Script libraries
× close