Class NotificationService

java.lang.Object
io.leandev.appfuse.notification.NotificationService

public class NotificationService extends Object

通知子系統的門面

接受 NotificationRequest,解析收件人(RecipientResolver)、 依 type×channel×locale 渲染(NotificationTemplateResolver)、把每則展開的訊息寫入 Outbox (PENDING),再對每列觸發 fast-path 非同步遞送(NotificationOutboxDispatcher.dispatchAsync(UUID))。 實際遞送與重試由 dispatcher 負責;本服務只到「寫入 Outbox + 觸發」為止。

一般經 NotificationEvent + @TransactionalEventListener(AFTER_COMMIT) 在交易後非同步進入; 不需該語意者亦可直接呼叫 notify(NotificationRequest)

租戶ADR-017 決策三):本服務不觸碰租戶欄位——tenant 專案的應用 Outbox entity 帶 @TenantId,寫入時由 Hibernate 於呼叫執行緒(請求 / 交易後同步,context 仍在)自動注入當前租戶;去重查詢 (NotificationOutboxRepositoryBase.findByDedupeKey(String) 單欄)同理自動限縮本租戶。ownership 專案的 entity 無租戶欄位、天然全域。後續非同步遞送再依列重建 context(見 dispatcher)。

Since:
4.0.0