Methods for managing a Temporal worker instance
Methods for managing a Temporal worker instance
(start client {:keys [task-queue] :as options})Starts a worker processing loop.
Arguments:
client: WorkflowClient instance returned from temporal.client.core/create-clientoptions: Worker start options (See worker-options)(start {:task-queue ::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 {:task-queue ::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 {:task-queue ::my-queue})]
...
(stop instance))
Stops a running worker.
Arguments:
- `instance`: Result returned from original call to ([[start]])
```clojure
(let [instance (start {:task-queue ::my-queue})]
...
(stop instance))
```Options for configuring workers (See start)
| Value | Mandatory | Description | Type | Default |
|---|---|---|---|---|
| :task-queue | 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 |
| ------------ | ----------- | ----------------------------------------------------------------- | ---------------- | ------- |
| :task-queue | 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 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 |