Method RedeemAsync
- Namespace
- MailFathom.Application.Signals
- Assembly
- MailFathom.Application.dll
RedeemAsync(string, CancellationToken)
Spends one ticket, reporting what it held.
Task<RedeemedClientSignalTicket?> RedeemAsync(string identifier, CancellationToken cancellationToken)
Parameters
identifierstringThe public half a connection presented, which is whatever a caller wrote.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<RedeemedClientSignalTicket>
What the ticket held, or null where no ticket stood under that identifier.
Remarks
One statement that removes and returns together, so exactly one presentation of a ticket wins whichever replica each of them reaches. An implementation that read and then removed would admit both. The expiry travels back rather than being compared here, because a ticket presented past it is spent as surely as one presented in time.
Exceptions
- ClientSignalTicketStoreUnavailableException
Thrown when the store could not answer, which the caller answers by refusing the connection rather than admitting it.