-
Notifications
You must be signed in to change notification settings - Fork 8
/
common.clj
25 lines (22 loc) · 1.78 KB
/
common.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;; Copyright © Manetu, Inc. All rights reserved
(ns temporal.common
(:require [temporal.internal.utils :as u])
(:import [io.temporal.common RetryOptions RetryOptions$Builder]))
(def retry-options
"
| Value | Description | Type | Default |
| ------------------------- | --------------------------------------------------------------------------- | ------------ | ------- |
| :initial-interval | Interval of the first retry. | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | |
| :backoff-coefficient | Coefficient used to calculate the next retry interval. | double | 0.0 |
| :maximum-attempts | When exceeded the amount of attempts, stop. | int | 0 (unlimited) |
| :maximum-interval | Maximum interval between retries. | [Duration](https://docs.oracle.com/javase/8/docs/api//java/time/Duration.html) | |
| :do-not-retry | List of application failures types to not retry. | list of strings | [] |
"
{:initial-interval #(.setInitialInterval ^RetryOptions$Builder %1 %2)
:backoff-coefficient #(.setBackoffCoefficient ^RetryOptions$Builder %1 %2)
:maximum-attempts #(.setMaximumAttempts ^RetryOptions$Builder %1 %2)
:maximum-interval #(.setMaximumInterval ^RetryOptions$Builder %1 %2)
:do-not-retry #(.setDoNotRetry ^RetryOptions$Builder %1 (into-array String %2))})
(defn ^:no-doc retry-options->
^RetryOptions [params]
(u/build (RetryOptions/newBuilder (RetryOptions/getDefaultInstance)) retry-options params))