56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Svrnty.CQRS.Sagas.Abstractions.Messaging;
|
|
|
|
/// <summary>
|
|
/// Message envelope for saga commands sent to remote services.
|
|
/// </summary>
|
|
public record SagaMessage
|
|
{
|
|
/// <summary>
|
|
/// Unique identifier for this message.
|
|
/// </summary>
|
|
public Guid MessageId { get; init; } = Guid.NewGuid();
|
|
|
|
/// <summary>
|
|
/// The saga instance ID.
|
|
/// </summary>
|
|
public Guid SagaId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Correlation ID for tracing across services.
|
|
/// </summary>
|
|
public Guid CorrelationId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Name of the saga step that sent this message.
|
|
/// </summary>
|
|
public string StepName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Fully qualified type name of the command.
|
|
/// </summary>
|
|
public string CommandType { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Serialized command payload (JSON).
|
|
/// </summary>
|
|
public string? Payload { get; init; }
|
|
|
|
/// <summary>
|
|
/// When the message was created.
|
|
/// </summary>
|
|
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
|
|
|
|
/// <summary>
|
|
/// Additional headers for the message.
|
|
/// </summary>
|
|
public Dictionary<string, string> Headers { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// Whether this is a compensation command.
|
|
/// </summary>
|
|
public bool IsCompensation { get; init; }
|
|
}
|