Table of Contents

Class AbstractMessageChannelWriter

Namespace
Steeltoe.Messaging.Support
Assembly
Steeltoe.Messaging.MessagingBase.dll
public abstract class AbstractMessageChannelWriter : ChannelWriter<IMessage>
Inheritance
AbstractMessageChannelWriter
Derived
Inherited Members

Constructors

AbstractMessageChannelWriter(AbstractMessageChannel, ILogger)

public AbstractMessageChannelWriter(AbstractMessageChannel channel, ILogger logger = null)

Parameters

channel AbstractMessageChannel
logger ILogger

Fields

channel

protected AbstractMessageChannel channel

Field Value

AbstractMessageChannel

logger

protected ILogger logger

Field Value

ILogger

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 Exception

An 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

bool

true if the item was written; otherwise, false.

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 CancellationToken

A 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 IMessage
cancellationToken CancellationToken

A CancellationToken used to cancel the write operation.

Returns

ValueTask

A ValueTask that represents the asynchronous write operation.