Class RetryPolicy

java.lang.Object
com.codename1.backend.messaging.RetryPolicy

public final class RetryPolicy extends Object

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
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    static String
    deadLetter(String destination)
    The dead-letter destination of destination.
    long
    delayAfter(int attempt)
    Milliseconds to wait before delivery attempt + 1, after delivery attempt failed.
    int
    Deliveries before a message is dead-lettered.
    of(Config config)
    The policy config describes.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 IOException
      The policy config describes.
      Throws:
      IOException
    • 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.