Table of Contents

Class BatchSendResult

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Transport.Abstractions.dll

Represents the result of a batch send operation. Replaces BatchPublishResult with cleaner naming aligned to the ITransportSender contract.

public sealed class BatchSendResult
Inheritance
BatchSendResult
Inherited Members
Extension Methods

Properties

Duration

Gets the time taken to send the entire batch.

public TimeSpan? Duration { get; init; }

Property Value

TimeSpan?

The batch duration, or null if not measured.

FailureCount

Gets the number of failed messages.

public int FailureCount { get; init; }

Property Value

int

The failure count.

IsCompleteSuccess

Gets a value indicating whether all messages were sent successfully.

public bool IsCompleteSuccess { get; }

Property Value

bool

true if all messages succeeded; otherwise, false.

Results

Gets the individual results for each message, one per input, in the order the inputs were given.

public IReadOnlyList<SendResult> Results { get; init; }

Property Value

IReadOnlyList<SendResult>

The per-message send results, index-aligned with the batch's input list.

Remarks

This is the batch contract every ITransportSender implementation must satisfy. It is stated here, once, rather than per provider: a contract described separately by each implementation is not a contract, because a consumer cannot write code that works across them and the next implementation is bound by nothing.

  1. Exactly one result per input. Results.Count equals the number of messages passed to SendBatchAsync(IReadOnlyList<TransportMessage>, CancellationToken), and equals SuccessCount + FailureCount. No input is omitted, coalesced with another, or reported twice — including when the send fails wholesale, when the batch is split across several provider calls, or when the operation is cancelled part way.
  2. Index-aligned. Results[i] is the outcome of messages[i]. Results are never grouped by outcome: an implementation must not return its successes followed by its failures, even if the underlying client reports them that way, because that ordering destroys the association a caller needs.
  3. Entries that took a fallback path are reported in place. Where a provider cannot fit every message into one native batch and sends the remainder individually, or retries part of the batch by another route, each such message's outcome still occupies its own input's index. The path a message took is an implementation detail; where its result appears is not.

Why it matters: selective retry. On a partial failure a caller resends exactly the inputs whose result failed. Without index alignment the only safe recovery is to resend the whole batch, which on an at-least-once transport manufactures duplicates of messages that were already delivered.

Known limitation — a result does not yet carry its input's identity portably. MessageId is documented as the broker's identifier, and implementations differ in practice over whether they report the broker's identifier or the input's own Id. A caller therefore cannot yet verify alignment from the result itself, and must rely on position. Until that is settled, treat a provider that groups results by outcome as a defect to report rather than something to detect at run time.

SuccessCount

Gets the number of successfully sent messages.

public int SuccessCount { get; init; }

Property Value

int

The success count.

TotalMessages

Gets the total number of messages in the batch.

public int TotalMessages { get; init; }

Property Value

int

The total message count.