Methods for managing a Temporal worker instance
Methods for managing a Temporal worker instance
(start client {:keys [queue-name] :as options})
Starts a worker processing loop.
Arguments:
client
: WorkflowClient instance returned from temporal.client.core/create-client
options
: Worker start options (See worker-options
)(start {:queue-name ::my-queue :ctx {:some "context"}})
Starts a worker processing loop. Arguments: - `client`: WorkflowClient instance returned from [[temporal.client.core/create-client]] - `options`: Worker start options (See [[worker-options]]) ```clojure (start {:queue-name ::my-queue :ctx {:some "context"}}) ```
(stop {:keys [factory] :as instance})
Stops a running worker.
Arguments:
instance
: Result returned from original call to (start
)(let [instance (start {:queue-name ::my-queue})]
...
(stop instance))
Stops a running worker. Arguments: - `instance`: Result returned from original call to ([[start]]) ```clojure (let [instance (start {:queue-name ::my-queue})] ... (stop instance)) ```
Options for configuring workers (See start
)
Value | Mandatory | Description | Type | Default |
---|---|---|---|---|
:queue-name | y | The name of the task-queue for this worker instance to listen on. | String / keyword | |
:ctx | An opaque handle that is passed back as the first argument of temporal.workflow/defworkflow and temporal.activity/defactivity , useful for passing state such as database or network connections. | <any> | nil | |
:dispatch | An optional map explicitly setting the dispatch table | See below | All visible activities/workers are automatically registered |
Value | Description |
---|---|
:activities | Vector of temporal.activity/defactivity symbols to register |
:workflows | Vector of temporal.workflow/defworkflow symbols to register |
(defactivity my-activity ...)
(defworkflow my-workflow ...)
(let [worker-options {:dispatch {:activities [my-activity] :workflows [my-workflow]}}]
...)
Options for configuring workers (See [[start]]) | Value | Mandatory | Description | Type | Default | | ------------ | ----------- | ----------------------------------------------------------------- | ---------------- | ------- | | :queue-name | y | The name of the task-queue for this worker instance to listen on. | String / keyword | | | :ctx | | An opaque handle that is passed back as the first argument of [[temporal.workflow/defworkflow]] and [[temporal.activity/defactivity]], useful for passing state such as database or network connections. | <any> | nil | | :dispatch | | An optional map explicitly setting the dispatch table | See below | All visible activities/workers are automatically registered | #### dispatch-table | Value | Description | | ------------ | ----------------------------------------------------------------- | | :activities | Vector of [[temporal.activity/defactivity]] symbols to register | | :workflows | Vector of [[temporal.workflow/defworkflow]] symbols to register | ```clojure (defactivity my-activity ...) (defworkflow my-workflow ...) (let [worker-options {:dispatch {:activities [my-activity] :workflows [my-workflow]}}] ...) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close