Record Class OutboundMessage

java.lang.Object
java.lang.Record
io.leandev.appfuse.notification.OutboundMessage
Record Components:
type - 通知型別鍵(供通道與稽核辨識)
recipientUserId - 收件人使用者識別(IN_APP 投遞 / 稽核;可為 null)
recipientAddress - 該通道的收件位址(已解析)
ccRecipientAddresses - EMAIL 通道的 CC 位址(其他通道為空)
subject - 已渲染主旨
body - 已渲染內文(EMAIL 為 HTML;SMS/LINE 為純文字)
deepLink - 附帶的深連結 URL(可為 null)
tenantId - 所屬租戶(遞送時供通道解析租戶資源,如租戶郵件設定)
deliveryId - 框架產生的 opaque 技術遞送識別;同一 Outbox 列重試時保持不變,供支援 idempotency 的 channel/provider 防止不確定結果後重送;舊呼叫端可為 null

public record OutboundMessage(String type, String recipientUserId, String recipientAddress, List<String> ccRecipientAddresses, String subject, String body, String deepLink, String tenantId, String deliveryId) extends Record

交付給通道遞送的單則訊息

NotificationService / dispatcher 把「已解析的收件位址 + 渲染內容 + 脈絡」組成,傳給 NotificationChannel.send(OutboundMessage)。位址已是該通道適用的形式(EMAIL→email、SMS→phone、LINE→lineUserId、 IN_APP→userId),通道直接使用、不需再認得 Recipient

Since:
4.0.0
  • Constructor Details

    • OutboundMessage

      public OutboundMessage(String type, String recipientUserId, String recipientAddress, List<String> ccRecipientAddresses, String subject, String body, String deepLink, String tenantId, String deliveryId)
      Creates an instance of a OutboundMessage record class.
      Parameters:
      type - the value for the type record component
      recipientUserId - the value for the recipientUserId record component
      recipientAddress - the value for the recipientAddress record component
      ccRecipientAddresses - the value for the ccRecipientAddresses record component
      subject - the value for the subject record component
      body - the value for the body record component
      deepLink - the value for the deepLink record component
      tenantId - the value for the tenantId record component
      deliveryId - the value for the deliveryId record component
    • OutboundMessage

      public OutboundMessage(String type, String recipientUserId, String recipientAddress, List<String> ccRecipientAddresses, String subject, String body, String deepLink, String tenantId)
      相容舊版 constructor(未指定 CC 時視為空清單)。
    • OutboundMessage

      public OutboundMessage(String type, String recipientUserId, String recipientAddress, String subject, String body, String deepLink, String tenantId)
      相容舊版 constructor(未指定 CC 與技術遞送識別時使用預設值)。
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • recipientUserId

      public String recipientUserId()
      Returns the value of the recipientUserId record component.
      Returns:
      the value of the recipientUserId record component
    • recipientAddress

      public String recipientAddress()
      Returns the value of the recipientAddress record component.
      Returns:
      the value of the recipientAddress record component
    • ccRecipientAddresses

      public List<String> ccRecipientAddresses()
      Returns the value of the ccRecipientAddresses record component.
      Returns:
      the value of the ccRecipientAddresses record component
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • deepLink

      public String deepLink()
      Returns the value of the deepLink record component.
      Returns:
      the value of the deepLink record component
    • tenantId

      public String tenantId()
      Returns the value of the tenantId record component.
      Returns:
      the value of the tenantId record component
    • deliveryId

      public String deliveryId()
      Returns the value of the deliveryId record component.
      Returns:
      the value of the deliveryId record component