21.252. Class RendezvousChannel<T>

Namespace: ArmoniK.Core.Common.Utils
Assembly: ArmoniK.Core.Common.dll

Queue to send T from a single producer to a consumer.

public class RendezvousChannel<T>

21.252.1. Type Parameters

T

Items to be sent through the channel

21.252.2. Inheritance

objectRendezvousChannel<T>

21.252.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

21.252.4. Remarks

When a producer writes a task handler, it will wait for a consumer to read the task handler.

If the producer successfully writes to the queue, the consumer is guaranteed to have successfully read from the queue.

If the producer fails to write to the queue, the consumer is guaranteed to not have read the produced the task handler.

21.252.5. Constructors

21.252.5.1. RendezvousChannel()

Create an instance

public RendezvousChannel()

21.252.6. Properties

21.252.6.1. IsReaderClosed

Whether the Reader has closed

public bool IsReaderClosed { get; }

21.252.6.1.1. Property Value

bool

21.252.6.2. IsWriterClosed

Whether the Writer has closed

public bool IsWriterClosed { get; }

21.252.6.2.1. Property Value

bool

21.252.7. Methods

21.252.7.1. CloseReader()

Close reader end of the Queue

public void CloseReader()

21.252.7.2. CloseWriter()

Close writer end of the Queue

public void CloseWriter()

21.252.7.3. ReadAsync(TimeSpan, CancellationToken)

Retrieve a value sent by the producer

public Task<T> ReadAsync(TimeSpan timeout, CancellationToken cancellationToken = default)

21.252.7.3.1. Parameters

timeout TimeSpan

Maximum time to wait for a producer

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.252.7.3.2. Returns

Task<T>

Task representing the asynchronous execution of the method

21.252.7.3.3. Exceptions

ChannelClosedException

The producer has been closed

OperationCanceledException

cancellationToken has been triggered

TimeoutException

No producer has written a handler in the allotted time

21.252.7.4. WaitForReader(TimeSpan, CancellationToken)

Wait for a consumer to be ready

public Task WaitForReader(TimeSpan timeout, CancellationToken cancellationToken = default)

21.252.7.4.1. Parameters

timeout TimeSpan

Maximum time to wait for a consumer

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.252.7.4.2. Returns

Task

Task representing the asynchronous execution of the method

21.252.7.4.3. Exceptions

ChannelClosedException

The consumer has been closed

OperationCanceledException

cancellationToken has been triggered

TimeoutException

No consumer was ready in the allotted time

21.252.7.5. WaitForWriter(TimeSpan, CancellationToken)

Wait for a producer to be ready

public Task WaitForWriter(TimeSpan timeout, CancellationToken cancellationToken = default)

21.252.7.5.1. Parameters

timeout TimeSpan

Maximum time to wait for a producer

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.252.7.5.2. Returns

Task

Task representing the asynchronous execution of the method

21.252.7.5.3. Exceptions

ChannelClosedException

The producer has been closed

OperationCanceledException

cancellationToken has been triggered

TimeoutException

No producer was ready in the allotted time

21.252.7.6. WriteAsync(T, TimeSpan, CancellationToken)

Send a value to the consumer

public Task WriteAsync(T value, TimeSpan timeout, CancellationToken cancellationToken = default)

21.252.7.6.1. Parameters

value T

The value to send

timeout TimeSpan

Maximum time to wait for a consumer

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.252.7.6.2. Returns

Task

Task representing the asynchronous execution of the method

21.252.7.6.3. Exceptions

ChannelClosedException

The consumer has been closed

OperationCanceledException

cancellationToken has been triggered

TimeoutException

No consumer arrived in the allotted time