|
3 | 3 | (:import [io.temporal.client WorkflowClientOptions WorkflowClientOptions$Builder] |
4 | 4 | [io.temporal.common.interceptors WorkflowClientInterceptorBase] |
5 | 5 | [io.temporal.client.schedules ScheduleClientOptions ScheduleClientOptions$Builder] |
6 | | - [io.temporal.serviceclient WorkflowServiceStubs WorkflowServiceStubsOptions WorkflowServiceStubsOptions$Builder])) |
| 6 | + [io.temporal.serviceclient WorkflowServiceStubs WorkflowServiceStubsOptions WorkflowServiceStubsOptions$Builder] |
| 7 | + [io.temporal.authorization AuthorizationTokenSupplier])) |
7 | 8 |
|
8 | 9 | (def workflow-client-options |
9 | 10 | " |
|
46 | 47 | ^ScheduleClientOptions [params] |
47 | 48 | (u/build (ScheduleClientOptions/newBuilder (ScheduleClientOptions/getDefaultInstance)) schedule-client-options params)) |
48 | 49 |
|
| 50 | +(defn ^:no-doc apikey-auth-fn-> |
| 51 | + ^AuthorizationTokenSupplier [f] |
| 52 | + (reify AuthorizationTokenSupplier |
| 53 | + (supply [_] |
| 54 | + (f)))) |
| 55 | + |
49 | 56 | (def stub-options |
50 | 57 | " |
51 | 58 | `WorkflowServiceStubsOptions` configuration map (See [[temporal.client.core/create-client]] or [[temporal.client.schedule/create-client]]) |
|
54 | 61 | | ------------------------- | --------------------------------------------------------------------------- | ------------ | ------- | |
55 | 62 | | :channel | Sets gRPC channel to use. Exclusive with target and sslContext | [ManagedChannel](https://grpc.github.io/grpc-java/javadoc/io/grpc/ManagedChannel.html) | | |
56 | 63 | | :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) | | |
| 64 | +| :api-key-fn | Sets [a function to return an API Key](https://docs.temporal.io/develop/java/temporal-client#connect-to-temporal-cloud-api-key) for authentication to Temporal Cloud | A 0-arity (fn) that evaluates to an API Key string | | |
57 | 65 | | :enable-https | Sets option to enable SSL/TLS/HTTPS for gRPC | boolean | false | |
58 | 66 | | :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 | |
59 | 67 | | :rpc-long-poll-timeout | Sets the rpc timeout value | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | 60s | |
|
70 | 78 | " |
71 | 79 | {:channel #(.setChannel ^WorkflowServiceStubsOptions$Builder %1 %2) |
72 | 80 | :ssl-context #(.setSslContext ^WorkflowServiceStubsOptions$Builder %1 %2) |
| 81 | + :api-key-fn #(.addApiKey ^WorkflowServiceStubsOptions$Builder %1 (apikey-auth-fn-> %2)) |
73 | 82 | :enable-https #(.setEnableHttps ^WorkflowServiceStubsOptions$Builder %1 %2) |
74 | 83 | :target #(.setTarget ^WorkflowServiceStubsOptions$Builder %1 %2) |
75 | 84 | :rpc-timeout #(.setRpcTimeout ^WorkflowServiceStubsOptions$Builder %1 %2) |
|
89 | 98 | (u/build (WorkflowServiceStubsOptions/newBuilder) stub-options params)) |
90 | 99 |
|
91 | 100 | (defn service-stub-> |
92 | | - [options timeout] |
93 | | - (WorkflowServiceStubs/newConnectedServiceStubs (stub-options-> options) timeout)) |
| 101 | + ([options] |
| 102 | + (WorkflowServiceStubs/newServiceStubs (stub-options-> options))) |
| 103 | + ([options timeout] |
| 104 | + (WorkflowServiceStubs/newConnectedServiceStubs (stub-options-> options) timeout))) |
0 commit comments