Table of Contents

Class SmsQueueEntity

Namespace
FishMMO.Database.Npgsql.Entities
Assembly
FishMMO-DB.dll

Outbound text message queue. Messages are inserted by the application layer and picked up by a background sender. Failed deliveries are retried up to a configurable maximum.

public class SmsQueueEntity : IVersionedEntity
Inheritance
SmsQueueEntity
Implements
Inherited Members

Remarks

Shaped exactly like EmailQueueEntity, claim columns and all, so one drain pattern serves both and a player choosing verify-by-SMS goes through the same queue semantics as one choosing email.

There is no SMS provider yet; the sender that drains this table only logs. The queue exists now so that callers record what would be sent, and adding a provider later changes the drain rather than every caller.

Properties

Attempts

Number of delivery attempts so far.

public int Attempts { get; set; }

Property Value

int

Body

Message text (max 480 chars).

[MaxLength(480)]
public string Body { get; set; }

Property Value

string

Remarks

Bounded because a text message is billed per segment: an unbounded body is an unbounded bill for one enqueue. 480 is room for a code and a sentence with plenty to spare.

ClaimedAt

UTC timestamp when this message was claimed for delivery.

public DateTime? ClaimedAt { get; set; }

Property Value

DateTime?

ClaimedBy

Identifier of the server that claimed this message for delivery.

public string? ClaimedBy { get; set; }

Property Value

string

CreatedAt

UTC timestamp when the message was enqueued.

public DateTime CreatedAt { get; set; }

Property Value

DateTime

ID

Primary key.

public long ID { get; set; }

Property Value

long

Kind

What this message is for; see SmsKind. Defaults to Verification (0) here and in the database.

public SmsKind Kind { get; set; }

Property Value

SmsKind

LastError

Error message from the most recent failed delivery attempt, or null.

public string? LastError { get; set; }

Property Value

string

RecipientPhone

Recipient number in E.164 form: a + and at most 15 digits, so 16 characters.

[MaxLength(16)]
public string RecipientPhone { get; set; }

Property Value

string

RecipientUsername

Associated account username for logging and rate-limiting.

public string RecipientUsername { get; set; }

Property Value

string

RequestKey

The writer's once-per-request identity: a retry after a lost reply finds the row its first attempt wrote instead of writing a second one. Null for rows written without one.

public Guid? RequestKey { get; set; }

Property Value

Guid?

SentAt

UTC timestamp when the message was sent, or null if still pending.

public DateTime? SentAt { get; set; }

Property Value

DateTime?

Version

Application-level concurrency token. Incremented on every write to detect stale updates.

public long Version { get; set; }

Property Value

long