You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Common/Common/Collections/QueueMessage.cs

50 lines
1.9 KiB

using Connected.Annotations;
using Connected.Collections.Queues;
using Connected.Data;
using Connected.Entities.Annotations;
using Connected.Entities.Concurrency;
namespace Common.Collections;
/// <inheritdoc cref="IQueueMessage"/>
[Table(Schema = SchemaAttribute.SysSchema)]
internal sealed record QueueMessage : ConcurrentEntity<long>, IQueueMessage
{
public const string CacheKey = $"{SchemaAttribute.SysSchema}.{nameof(QueueMessage)}";
/// <inheritdoc cref="IQueueMessage.Created"/>
[Ordinal(0), Date(Kind = DateKind.DateTime)]
public DateTime Created { get; init; }
/// <inheritdoc cref="IQueueMessage.DequeueCount"/>
[Ordinal(2)]
public int DequeueCount { get; init; }
/// <inheritdoc cref="IQueueMessage.DequeueTimestamp"/>
[Ordinal(3), Date(Kind = DateKind.DateTime)]
public DateTime? DequeueTimestamp { get; init; }
/// <inheritdoc cref="IQueueMessage.Queue"/>
[Ordinal(4), Length(32)]
public string Queue { get; init; } = default!;
/// <summary>
/// The serialized value of the arguments if specified.
/// </summary>
/// <remarks>
/// If the queue message must be persisted the arguments get serialized
/// and stored in this property. When selected from the storage, the
/// Arguments object is recreated from this property.
/// Note that queue serialized Arguments must be less that 1024 characters long.
/// </
[Ordinal(7), Length(1024)]
public string? SerializedArguments { get; init; }
/// <inheritdoc cref="IPopReceipt.NextVisible"/>
[Ordinal(8), Date(Kind = DateKind.DateTime)]
public DateTime NextVisible { get; init; }
/// <inheritdoc cref="IPopReceipt.PopReceipt"/>
[Ordinal(9)]
public Guid? PopReceipt { get; init; }
/// <inheritdoc cref="IPopReceipt.PopReceipt"/>
/// <remarks>
/// This property is persisted through the <see cref="SerializedArguments"/>
/// property.
/// </remarks>
[Persistence(Persistence = ColumnPersistence.InMemory)]
public QueueArgs Arguments { get; init; }
}