Skip to content

IOutbox Methods

Stages opaque durable messages alongside a grain's journaled business state.

Register(IOutboxMessageSource)

abstract
public abstract IOutbox Register(IOutboxMessageSource source)
Registers a source which provides messages sent through IOutbox.

Parameters

sourceIOutboxMessageSource
The source.

Returns

This outbox.

Send(MessageId)

abstract
public abstract void Send(MessageId messageId)
Synchronously stages, for the grain's next journal write, a message which a registered IOutboxMessageSource provides.

Parameters

messageIdMessageId
The message ID, which a registered source provides.

Exceptions

System.ArgumentException
The ID is unset or too long, or the source's message is invalid or addressed to the sending grain.
System.InvalidOperationException
The ID is pending as an ordinary message, no registered source provides it, the source returned a different ID, or the outbox is unavailable.

Send(OutboxMessage)

abstract
public abstract void Send(OutboxMessage message)
Synchronously stages an outgoing command for the grain's next journal write.

Parameters

messageOutboxMessage
The fully built outgoing message and required receiver.

Exceptions

System.ArgumentException
The envelope has an unset identity, invalid subject or destination, or exceeds identity/subject limits.
System.InvalidOperationException
The identity conflicts, an inbox sink backpressured a message addressed to the sending grain, or the outbox is unavailable.

Withdraw(MessageId)

abstract
public abstract bool Withdraw(MessageId messageId)
Synchronously stages, for the grain's next journal write, the removal of a pending message which a registered IOutboxMessageSource provides.

Parameters

messageIdMessageId
The ID of a message sent through IOutbox.

Returns

true when the outbox staged the removal; false when no such message is pending.

Exceptions

System.InvalidOperationException
The ID is pending as an ordinary message, or the outbox is unavailable.