public class Retrier
extends java.lang.Object
THIS CLASS IS EXPERIMENTAL AND THE API IS SUBJECT TO CHANGE
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
execute(RetryConfig config,
RetryAction<T> action)
Execute the supplied action with the given retry config.
|
static <T> T |
execute(RetryConfig config,
RetryAction<T> action,
RetryObserver observer)
Execute the supplied action with the given retry config.
|
static PublishAck |
publish(JetStream js,
Message message)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the default retry config is exhausted.
|
static PublishAck |
publish(JetStream js,
Message message,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(JetStream js,
java.lang.String subject,
byte[] body)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the default retry config is exhausted.
|
static PublishAck |
publish(JetStream js,
java.lang.String subject,
byte[] body,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the default retry config is exhausted.
|
static PublishAck |
publish(JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the default retry config is exhausted.
|
static PublishAck |
publish(JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the default retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
Message message)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
Message message,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
java.lang.String subject,
byte[] body)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
java.lang.String subject,
byte[] body,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static PublishAck |
publish(RetryConfig config,
JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body,
PublishOptions options)
Send a message to the specified subject and waits for a response from Jetstream,
retrying until the ack is received or the retry config is exhausted.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
Message message)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
Message message,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
java.lang.String subject,
byte[] body)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
java.lang.String subject,
byte[] body,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
Message message)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
Message message,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
java.lang.String subject,
byte[] body)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
java.lang.String subject,
byte[] body,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body)
Send a message to the specified subject, executing in a future.
|
static java.util.concurrent.CompletableFuture<PublishAck> |
publishAsync(RetryConfig config,
JetStream js,
java.lang.String subject,
io.nats.client.impl.Headers headers,
byte[] body,
PublishOptions options)
Send a message to the specified subject, executing in a future.
|
public static <T> T execute(RetryConfig config, RetryAction<T> action) throws java.lang.Exception
T - the return typeconfig - The custom retry configaction - The retry actionjava.lang.Exception - various execution exceptions; only thrown if all retries failed.public static <T> T execute(RetryConfig config, RetryAction<T> action, RetryObserver observer) throws java.lang.Exception
T - the return typeconfig - The custom retry configaction - The retry actionobserver - The retry observerjava.lang.Exception - various execution exceptions; only thrown if all retries failed
or the observer declines to retry.public static PublishAck publish(RetryConfig config, JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body, PublishOptions options) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(RetryConfig config, JetStream js, java.lang.String subject, byte[] body) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message tobody - the message bodyjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(RetryConfig config, JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(RetryConfig config, JetStream js, java.lang.String subject, byte[] body, PublishOptions options) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message tobody - the message bodyoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(RetryConfig config, JetStream js, Message message) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextmessage - the message to publishjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(RetryConfig config, JetStream js, Message message, PublishOptions options) throws java.lang.Exception
config - The custom retry configjs - the JetStream contextmessage - the message to publishoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body, PublishOptions options) throws java.lang.Exception
js - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, java.lang.String subject, byte[] body) throws java.lang.Exception
js - the JetStream contextsubject - the subject to send the message tobody - the message bodyjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body) throws java.lang.Exception
js - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, java.lang.String subject, byte[] body, PublishOptions options) throws java.lang.Exception
js - the JetStream contextsubject - the subject to send the message tobody - the message bodyoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, Message message) throws java.lang.Exception
js - the JetStream contextmessage - the message to publishjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static PublishAck publish(JetStream js, Message message, PublishOptions options) throws java.lang.Exception
js - the JetStream contextmessage - the message to publishoptions - publish optionsjava.lang.Exception - various communication issues with the NATS server; only thrown if all retries failed.public static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body, PublishOptions options)
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyoptions - publish optionspublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, java.lang.String subject, byte[] body)
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message tobody - the message bodypublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body)
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodypublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, java.lang.String subject, byte[] body, PublishOptions options)
config - The custom retry configjs - the JetStream contextsubject - the subject to send the message tobody - the message bodyoptions - publish optionspublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, Message message)
config - The custom retry configjs - the JetStream contextmessage - the message to publishpublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(RetryConfig config, JetStream js, Message message, PublishOptions options)
config - The custom retry configjs - the JetStream contextmessage - the message to publishoptions - publish optionspublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body, PublishOptions options)
js - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodyoptions - publish optionspublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, java.lang.String subject, byte[] body)
js - the JetStream contextsubject - the subject to send the message tobody - the message bodypublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, java.lang.String subject, io.nats.client.impl.Headers headers, byte[] body)
js - the JetStream contextsubject - the subject to send the message toheaders - optional headers to publish with the message.body - the message bodypublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, java.lang.String subject, byte[] body, PublishOptions options)
js - the JetStream contextsubject - the subject to send the message tobody - the message bodyoptions - publish optionspublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, Message message)
js - the JetStream contextmessage - the message to publishpublic static java.util.concurrent.CompletableFuture<PublishAck> publishAsync(JetStream js, Message message, PublishOptions options)
js - the JetStream contextmessage - the message to publishoptions - publish options