Record Class DeliveryResult
java.lang.Object
java.lang.Record
io.leandev.appfuse.notification.DeliveryResult
- Record Components:
delivered- 是否遞送成功suppressed- 是否因政策被抑制(確定性、不重試);僅在delivered=false時有意義detail- 補充訊息(成功可為 provider 回執;失敗 / 抑制為原因)
單則通道遞送的結果
NotificationChannel.send(OutboundMessage) 的回傳。delivered 為 false 時 detail 應載明原因,
供 Outbox 記錄 lastError 並決定後續處理。
三種結果:
- 成功(
delivered=true)→ Outbox 轉SENT - 失敗(
delivered=false, suppressed=false)→ 可重試,Outbox 退避重試、逾上限轉DEAD - 抑制(
delivered=false, suppressed=true)→ 確定性政策封鎖(如防火牆全擋),不重試, Outbox 直接轉SUPPRESSED。與失敗區分,避免無謂重試與假成功
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionDeliveryResult(boolean delivered, boolean suppressed, String detail) Creates an instance of aDeliveryResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thedeliveredrecord component.detail()Returns the value of thedetailrecord component.final booleanIndicates whether some other object is "equal to" this one.static DeliveryResult遞送失敗(可重試)final inthashCode()Returns a hash code value for this object.static DeliveryResultok()遞送成功booleanReturns the value of thesuppressedrecord component.static DeliveryResultsuppressed(String detail) 因政策被抑制(確定性封鎖,不重試)final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DeliveryResult
Creates an instance of aDeliveryResultrecord class.- Parameters:
delivered- the value for thedeliveredrecord componentsuppressed- the value for thesuppressedrecord componentdetail- the value for thedetailrecord component
-
-
Method Details
-
ok
-
failed
遞送失敗(可重試)- Parameters:
detail- 失敗原因- Returns:
- 失敗結果
-
suppressed
因政策被抑制(確定性封鎖,不重試)- Parameters:
detail- 抑制原因- Returns:
- 抑制結果
-
toString
-
hashCode
-
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
delivered
-
suppressed
public boolean suppressed()Returns the value of thesuppressedrecord component.- Returns:
- the value of the
suppressedrecord component
-
detail
-