Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class RetryPolicy
- Object
- RetryPolicy
How often a failed message is delivered again, and how long apart.
| Setting | Default | |
|---|---|---|
cn1.messaging.retry.max-attempts | 3 | deliveries before the dead-letter destination |
cn1.messaging.retry.backoff | 1000 | milliseconds before the second delivery |
cn1.messaging.retry.multiplier | 2 | how much longer each wait is than the last |
cn1.messaging.retry.max-backoff | 30000 | the longest wait |
Constructors
public RetryPolicy(int maxAttempts, long backoffMillis, int multiplier, long maxBackoffMillis) | A policy of maxAttempts deliveries, waiting backoffMillis and then multiplier times longer each time, up to maxBackoffMillis. |
Methods
public static RetryPolicy of(Config config)
throws IOException | The policy config describes. |
public int getMaxAttempts() | Deliveries before a message is dead-lettered. |
public long delayAfter(int attempt) | Milliseconds to wait before delivery attempt + 1, after delivery attempt failed. |
public static String deadLetter(String destination) | The dead-letter destination of destination. |
Inherited methods
Constructor details
RetryPolicy
public RetryPolicy(int maxAttempts, long backoffMillis, int multiplier, long maxBackoffMillis)A policy of
maxAttempts deliveries, waiting backoffMillis and then
multiplier times longer each time, up to maxBackoffMillis.Method details
of
public static RetryPolicy of(Config config)
throws IOExceptionThe policy
config describes.Throws
getMaxAttempts
public int getMaxAttempts()Deliveries before a message is dead-lettered.
delayAfter
public long delayAfter(int attempt)Milliseconds to wait before delivery
attempt + 1, after delivery
attempt failed.deadLetter
public static String deadLetter(String destination)The dead-letter destination of
destination.