Interface RetryPolicyResolver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RetryPolicyResolver

依通知型別解析 RetryPolicy 的 SPI

讓重試政策(嘗試上限 + 退避)可 per notification type 配置,例如高時效安全通知 使用「低次數、高頻率」、business 通知維持全域預設。 由 NotificationService(讀 maxAttempts)與 NotificationOutboxDispatcher(讀 backoff)共用,故同型別的重試行為一致。

應用層通常以設定(如 app.notification.retry.per-type)建構一個「per-type 覆蓋 → fallback 全域」 的實作;不需 per-type 差異者用 constant(RetryPolicy) 包一個全域政策即可。

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    建立一個忽略型別、一律回傳同一政策的 resolver(無 per-type 差異時使用)
    解析指定通知型別的重試政策
  • Method Details

    • forType

      RetryPolicy forType(String type)
      解析指定通知型別的重試政策
      Parameters:
      type - 通知型別鍵(如 order.createdauth.email-otp)
      Returns:
      該型別的重試政策(不可為 null;無 per-type 設定時回全域預設)
    • constant

      static RetryPolicyResolver constant(RetryPolicy policy)
      建立一個忽略型別、一律回傳同一政策的 resolver(無 per-type 差異時使用)
      Parameters:
      policy - 全域政策
      Returns:
      對任何型別皆回傳 policy 的 resolver