Class AbstractMessageChannelWriter
public abstract class AbstractMessageChannelWriter : ChannelWriter<IMessage>
- Inheritance
-
AbstractMessageChannelWriter
- Derived
- Inherited Members
Constructors
AbstractMessageChannelWriter(AbstractMessageChannel, ILogger)
public AbstractMessageChannelWriter(AbstractMessageChannel channel, ILogger logger = null)
Parameters
channel
AbstractMessageChannellogger
ILogger
Fields
channel
protected AbstractMessageChannel channel
Field Value
logger
protected ILogger logger
Field Value
Methods
TryComplete(Exception)
Attempts to mark the channel as being completed, meaning no more data will be written to it.
public override bool TryComplete(Exception error = null)
Parameters
error
ExceptionAn Exception indicating the failure causing no more data to be written, or null for success.
Returns
- bool
<a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if this operation successfully completes the channel; otherwise, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if the channel could not be marked for completion,
for example due to having already been marked as such, or due to not supporting completion. .
TryWrite(IMessage)
Attempts to write the specified item to the channel.
public override bool TryWrite(IMessage message)
Parameters
message
IMessage
Returns
WaitToWriteAsync(CancellationToken)
Returns a ValueTask<TResult> that will complete when space is available to write an item.
public override ValueTask<bool> WaitToWriteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA CancellationToken used to cancel the wait operation.
Returns
- ValueTask<bool>
A ValueTask<TResult> that will complete with a true result when space is available to write an item or with a false result when no further writing will be permitted.
WriteAsync(IMessage, CancellationToken)
Asynchronously writes an item to the channel.
public override ValueTask WriteAsync(IMessage message, CancellationToken cancellationToken = default)
Parameters
message
IMessagecancellationToken
CancellationTokenA CancellationToken used to cancel the write operation.