Liking cljdoc? Tell your friends :D

temporal.client.worker

Methods for managing a Temporal worker instance

Methods for managing a Temporal worker instance
raw docstring

startclj

(start client {:keys [queue-name] :as options})

Starts a worker processing loop.

Arguments:

(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"}})
```
sourceraw docstring

stopclj

(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))
```
sourceraw docstring

worker-optionsclj

Options for configuring workers (See start)

ValueMandatoryDescriptionTypeDefault
:queue-nameyThe 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 tableSee belowAll visible activities/workers are automatically registered

dispatch-table

ValueDescription
:activitiesVector of temporal.activity/defactivity symbols to register
:workflowsVector 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]}}]
   ...)
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close