feat(notification-outbox): add notification message and outbox query contracts
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace ScadaLink.Commons.Messages.Notification;
|
||||
|
||||
/// <summary>
|
||||
/// Site -> Central: submit a notification for central delivery.
|
||||
/// Fire-and-forget with ack; the site retries until a <see cref="NotificationSubmitAck"/> is received.
|
||||
/// </summary>
|
||||
public record NotificationSubmit(
|
||||
string NotificationId,
|
||||
string ListName,
|
||||
string Subject,
|
||||
string Body,
|
||||
string SourceSiteId,
|
||||
string? SourceInstanceId,
|
||||
string? SourceScript,
|
||||
DateTimeOffset SiteEnqueuedAt);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Site: ack sent after the notification row is persisted.
|
||||
/// Idempotent — safe to re-send for the same <see cref="NotificationId"/>.
|
||||
/// </summary>
|
||||
public record NotificationSubmitAck(
|
||||
string NotificationId,
|
||||
bool Accepted,
|
||||
string? Error);
|
||||
|
||||
/// <summary>
|
||||
/// Site -> Central: query the central delivery status for a <see cref="NotificationId"/>.
|
||||
/// </summary>
|
||||
public record NotificationStatusQuery(
|
||||
string CorrelationId,
|
||||
string NotificationId);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Site: response carrying the current delivery status for a queried notification.
|
||||
/// </summary>
|
||||
public record NotificationStatusResponse(
|
||||
string CorrelationId,
|
||||
bool Found,
|
||||
string Status,
|
||||
int RetryCount,
|
||||
string? LastError,
|
||||
DateTimeOffset? DeliveredAt);
|
||||
@@ -0,0 +1,92 @@
|
||||
namespace ScadaLink.Commons.Messages.Notification;
|
||||
|
||||
/// <summary>
|
||||
/// Outbox UI -> Central: paginated, filtered query over the notification outbox.
|
||||
/// All filter fields are optional; <see cref="StuckOnly"/> restricts results to stuck notifications.
|
||||
/// </summary>
|
||||
public record NotificationOutboxQueryRequest(
|
||||
string CorrelationId,
|
||||
string? StatusFilter,
|
||||
string? TypeFilter,
|
||||
string? SourceSiteFilter,
|
||||
string? ListNameFilter,
|
||||
bool StuckOnly,
|
||||
string? SubjectKeyword,
|
||||
DateTimeOffset? From,
|
||||
DateTimeOffset? To,
|
||||
int PageNumber,
|
||||
int PageSize);
|
||||
|
||||
/// <summary>
|
||||
/// A single notification row summarised for outbox UI display.
|
||||
/// </summary>
|
||||
public record NotificationSummary(
|
||||
string NotificationId,
|
||||
string Type,
|
||||
string ListName,
|
||||
string Subject,
|
||||
string Status,
|
||||
int RetryCount,
|
||||
string? LastError,
|
||||
string SourceSiteId,
|
||||
string? SourceInstanceId,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset? DeliveredAt,
|
||||
bool IsStuck);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Outbox UI: paginated response for a <see cref="NotificationOutboxQueryRequest"/>.
|
||||
/// </summary>
|
||||
public record NotificationOutboxQueryResponse(
|
||||
string CorrelationId,
|
||||
bool Success,
|
||||
string? ErrorMessage,
|
||||
IReadOnlyList<NotificationSummary> Notifications,
|
||||
int TotalCount);
|
||||
|
||||
/// <summary>
|
||||
/// Outbox UI -> Central: request to immediately retry delivery of a notification.
|
||||
/// </summary>
|
||||
public record RetryNotificationRequest(
|
||||
string CorrelationId,
|
||||
string NotificationId);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Outbox UI: result of a <see cref="RetryNotificationRequest"/>.
|
||||
/// </summary>
|
||||
public record RetryNotificationResponse(
|
||||
string CorrelationId,
|
||||
bool Success,
|
||||
string? ErrorMessage);
|
||||
|
||||
/// <summary>
|
||||
/// Outbox UI -> Central: request to discard (cancel) a pending or stuck notification.
|
||||
/// </summary>
|
||||
public record DiscardNotificationRequest(
|
||||
string CorrelationId,
|
||||
string NotificationId);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Outbox UI: result of a <see cref="DiscardNotificationRequest"/>.
|
||||
/// </summary>
|
||||
public record DiscardNotificationResponse(
|
||||
string CorrelationId,
|
||||
bool Success,
|
||||
string? ErrorMessage);
|
||||
|
||||
/// <summary>
|
||||
/// Outbox UI -> Central: request for the notification outbox KPI summary.
|
||||
/// </summary>
|
||||
public record NotificationKpiRequest(
|
||||
string CorrelationId);
|
||||
|
||||
/// <summary>
|
||||
/// Central -> Outbox UI: KPI summary for the notification outbox dashboard.
|
||||
/// </summary>
|
||||
public record NotificationKpiResponse(
|
||||
string CorrelationId,
|
||||
int QueueDepth,
|
||||
int StuckCount,
|
||||
int ParkedCount,
|
||||
int DeliveredLastInterval,
|
||||
TimeSpan? OldestPendingAge);
|
||||
Reference in New Issue
Block a user