Liking cljdoc? Tell your friends :D

temporal.client.core

Methods for client interaction with Temporal

Methods for client interaction with Temporal
raw docstring

>!clj

(>! {:keys [stub] :as workflow} signal-name params)

Sends 'params' as a signal 'signal-name' to 'workflow'

(>! workflow ::my-signal {:msg "Hi"})
Sends 'params' as a signal 'signal-name' to 'workflow'

```clojure
(>! workflow ::my-signal {:msg "Hi"})
```
sourceraw docstring

cancelclj

(cancel {:keys [stub] :as workflow})

Gracefully cancels 'workflow'

(cancel workflow)
Gracefully cancels 'workflow'

```clojure
(cancel workflow)
```
sourceraw docstring

create-clientclj

(create-client)
(create-client options)
(create-client options timeout)

Creates a new client instance suitable for implementing Temporal workers (See temporal.client.worker/start) or workflow clients (See create-workflow).

Arguments:

  • options: Client configuration option map (See below)
  • timeout: Connection timeout as a Duration (default: 5s)

options map

ValueDescriptionTypeDefault
:targetSets the connection host:portString"127.0.0.1:7233"
:identityOverrides the worker node identity (workers only)String
:namespaceSets the Temporal namespace context for this clientString
:data-converterOverrides the data converter used to serialize arguments and results.DataConverter
:interceptorsCollection of interceptors used to intercept workflow client calls.WorkflowClientInterceptor
:channelSets gRPC channel to use. Exclusive with target and sslContextManagedChannel
:ssl-contextSets gRPC SSL Context to use (See temporal.tls/new-ssl-context)SslContext
:enable-httpsSets option to enable SSL/TLS/HTTPS for gRPCbooleanfalse
:rpc-timeoutSets the rpc timeout value for non query and non long poll callsDuration10s
:rpc-long-poll-timeoutSets the rpc timeout valueDuration60s
:rpc-query-timeoutSets the rpc timeout for queriesDuration10s
:backoff-reset-freqSets frequency at which gRPC connection backoff should be reset practicallyDuration10s
:grpc-reconnect-freqSets frequency at which gRPC channel will be moved into an idle stateDuration60s
:headersSet the headersMetadata
:enable-keepaliveSet keep alive ping from client to the serverbooleanfalse
:keepalive-timeSet the keep alive timeDuration
:keepalive-timeoutSet the keep alive timeoutDuration
:keepalive-without-streamSet if client sends keepalive pings even with no active RPCsbooleanfalse
:metrics-scopeThe scope to be used for metrics reportingScope
Creates a new client instance suitable for implementing Temporal workers (See [[temporal.client.worker/start]]) or
workflow clients (See [[create-workflow]]).

Arguments:

- `options`: Client configuration option map (See below)
- `timeout`: Connection timeout as a [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) (default: 5s)

#### options map


| Value                     | Description                                                                 | Type         | Default |
| ------------------------- | --------------------------------------------------------------------------- | ------------ | ------- |
| :target                   | Sets the connection host:port                                               | String       | "127.0.0.1:7233" |
| :identity                 | Overrides the worker node identity (workers only)                           | String       | |
| :namespace                | Sets the Temporal namespace context for this client                         | String       | |
| :data-converter           | Overrides the data converter used to serialize arguments and results.       | [DataConverter](https://www.javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/common/converter/DataConverter.html) | |
| :interceptors             | Collection of interceptors used to intercept workflow client calls.         | [WorkflowClientInterceptor](https://javadoc.io/doc/io.temporal/temporal-sdk/latest/io/temporal/common/interceptors/WorkflowClientInterceptor.html) | |
| :channel                  | Sets gRPC channel to use. Exclusive with target and sslContext              | [ManagedChannel](https://grpc.github.io/grpc-java/javadoc/io/grpc/ManagedChannel.html) | |
| :ssl-context              | Sets gRPC SSL Context to use (See [[temporal.tls/new-ssl-context]])         | [SslContext](https://netty.io/4.0/api/io/netty/handler/ssl/SslContext.html) | |
| :enable-https             | Sets option to enable SSL/TLS/HTTPS for gRPC                                | boolean      | false |
| :rpc-timeout              | Sets the rpc timeout value for non query and non long poll calls            | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 10s |
| :rpc-long-poll-timeout    | Sets the rpc timeout value                                                  | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 60s |
| :rpc-query-timeout        | Sets the rpc timeout for queries                                            | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 10s |
| :backoff-reset-freq       | Sets frequency at which gRPC connection backoff should be reset practically | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 10s |
| :grpc-reconnect-freq      | Sets frequency at which gRPC channel will be moved into an idle state       | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 60s |
| :headers                  | Set the headers                                                             | [Metadata](https://grpc.github.io/grpc-java/javadoc/io/grpc/Metadata.html) | |
| :enable-keepalive         | Set keep alive ping from client to the server                               | boolean       | false |
| :keepalive-time           | Set the keep alive time                                                     | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | |
| :keepalive-timeout        | Set the keep alive timeout                                                  | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | |
| :keepalive-without-stream | Set if client sends keepalive pings even with no active RPCs                | boolean       | false |
| :metrics-scope            | The scope to be used for metrics reporting                                  | [Scope](https://github.com/uber-java/tally/blob/master/core/src/main/java/com/uber/m3/tally/Scope.java) | |
sourceraw docstring

create-workflowclj

(create-workflow client workflow-id)
(create-workflow client workflow options)

Create a new workflow-stub instance, suitable for managing and interacting with a workflow through it's lifecycle.

N.B.: The workflow will remain in an uninitialized and idle state until explicitly started with either (start) or (signal-with-start).

(defworkflow my-workflow
  [ctx args]
  ...)

(let [w (create client my-workflow {:task-queue ::my-task-queue})]
  ;; do something with the instance 'w')
Create a new workflow-stub instance, suitable for managing and interacting with a workflow through it's lifecycle.

*N.B.: The workflow will remain in an uninitialized and idle state until explicitly started with either ([[start]]) or
([[signal-with-start]]).*

```clojure
(defworkflow my-workflow
  [ctx args]
  ...)

(let [w (create client my-workflow {:task-queue ::my-task-queue})]
  ;; do something with the instance 'w')
```
  
sourceraw docstring

get-resultclj

(get-result {:keys [stub] :as workflow})

Retrieves the final result of 'workflow'. Returns a promise that when derefed will resolve to the evaluation of the defworkflow once the workflow concludes.

(defworkflow my-workflow
  [ctx args]
  ...)

(let [w (create ...)]
   (start w ...)
   @(get-result w))
Retrieves the final result of 'workflow'.  Returns a promise that when derefed will resolve to the evaluation of the
defworkflow once the workflow concludes.

```clojure
(defworkflow my-workflow
  [ctx args]
  ...)

(let [w (create ...)]
   (start w ...)
   @(get-result w))
```
sourceraw docstring

queryclj

(query {:keys [stub] :as workflow} query-type args)

Sends query with 'query-type' and 'args' to 'workflow', returns a value. The query result is computed by a query-handler, registered inside the workflow definition using temporal.workflow/register-query-handler!.

Arguments:

  • query-type: keyword (or coerceable into a keyword)
  • args: serializable query params
(query workflow ::my-query {:foo "bar"})
Sends query with 'query-type' and 'args' to 'workflow', returns a value.
The query result is computed by a query-handler, registered inside the workflow definition
using [[temporal.workflow/register-query-handler!]].

Arguments:
- `query-type`: keyword (or coerceable into a keyword)
- `args`: serializable query params

```clojure
(query workflow ::my-query {:foo "bar"})
```
sourceraw docstring

signal-with-startclj

(signal-with-start {:keys [stub] :as workflow}
                   signal-name
                   signal-params
                   wf-params)

Signals 'workflow' with 'signal-params' on signal 'signal-name', starting it if not already running. 'wf-params' are used as workflow start arguments if the workflow needs to be started

Signals 'workflow' with 'signal-params' on signal 'signal-name', starting it if not already running.  'wf-params' are
used as workflow start arguments if the workflow needs to be started
sourceraw docstring

startclj

(start {:keys [stub] :as workflow} params)

Starts 'worklow' with 'params'

Starts 'worklow' with 'params'
sourceraw docstring

terminateclj

(terminate {:keys [stub] :as workflow} reason params)

Forcefully terminates 'workflow'

(terminate workflow "unresponsive", {})
Forcefully terminates 'workflow'

```clojure
(terminate workflow "unresponsive", {})
```
sourceraw docstring

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

× close