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-client
options
: 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 | |
:max-concurrent-activity-task-pollers | Number of simultaneous poll requests on activity task queue. Consider incrementing if the worker is not throttled due to MaxActivitiesPerSecond or MaxConcurrentActivityExecutionSize options and still cannot keep up with the request rate. | int | 5 | |
:max-concurrent-activity-execution-size | Maximum number of activities executed in parallel. | int | 200 | |
:max-concurrent-local-activity-execution-size | Maximum number of local activities executed in parallel. | int | 200 | |
:max-concurrent-workflow-task-pollers | Number of simultaneous poll requests on workflow task queue. | int | 2 | |
:max-concurrent-workflow-task-execution-size | Maximum number of simultaneously executed workflow tasks. | int | 200 | |
:default-deadlock-detection-timeout | Time period in ms that will be used to detect workflow deadlock. | long | 1000 | |
:default-heartbeat-throttle-interval | Default amount of time between sending each pending heartbeat. | Duration | 30s | |
:max-heartbeat-throttle-interval | Maximum amount of time between sending each pending heartbeat. | Duration | 60s | |
:local-activity-worker-only | Worker should only handle workflow tasks and local activities. | boolean | false | |
:max-taskqueue-activities-per-second | Sets the rate limiting on number of activities per second. | double | 0.0 (unlimited) | |
:max-workers-activities-per-second | Maximum number of activities started per second. | double | 0.0 (unlimited) |
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 | | :max-concurrent-activity-task-pollers | | Number of simultaneous poll requests on activity task queue. Consider incrementing if the worker is not throttled due to `MaxActivitiesPerSecond` or `MaxConcurrentActivityExecutionSize` options and still cannot keep up with the request rate. | int | 5 | | :max-concurrent-activity-execution-size | | Maximum number of activities executed in parallel. | int | 200 | | :max-concurrent-local-activity-execution-size | | Maximum number of local activities executed in parallel. | int | 200 | | :max-concurrent-workflow-task-pollers | | Number of simultaneous poll requests on workflow task queue. | int | 2 | | :max-concurrent-workflow-task-execution-size | | Maximum number of simultaneously executed workflow tasks. | int | 200 | | :default-deadlock-detection-timeout | | Time period in ms that will be used to detect workflow deadlock. | long | 1000 | | :default-heartbeat-throttle-interval | | Default amount of time between sending each pending heartbeat. | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 30s | | :max-heartbeat-throttle-interval | | Maximum amount of time between sending each pending heartbeat. | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 60s | | :local-activity-worker-only | | Worker should only handle workflow tasks and local activities. | boolean | false | | :max-taskqueue-activities-per-second | | Sets the rate limiting on number of activities per second. | double | 0.0 (unlimited) | | :max-workers-activities-per-second | | Maximum number of activities started per second. | double | 0.0 (unlimited) | #### 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