Table of Contents

Class DeadlinePipelineExtensions

Namespace
IceRpc
Assembly
IceRpc.Deadline.dll

Provides extension methods for Pipeline to add the deadline interceptor.

public static class DeadlinePipelineExtensions
Inheritance
DeadlinePipelineExtensions
Inherited Members

Methods

UseDeadline(Pipeline)

Adds a DeadlineInterceptor with an infinite default timeout to this pipeline. This interceptor enforces the deadlines it receives and does not create new deadlines.

public static Pipeline UseDeadline(this Pipeline pipeline)

Parameters

pipeline Pipeline

The pipeline being configured.

Returns

Pipeline

The pipeline being configured.

Examples

The following code adds the deadline interceptor to the invocation pipeline.

await using var connection = new ClientConnection(new Uri("icerpc://localhost"));

// Create an invocation pipeline, that uses the deadline interceptor.
Pipeline pipeline = new Pipeline()
    .UseDeadline()
    .Into(connection);

UseDeadline(Pipeline, TimeSpan, bool)

Adds a DeadlineInterceptor to this pipeline.

public static Pipeline UseDeadline(this Pipeline pipeline, TimeSpan defaultTimeout, bool alwaysEnforceDeadline = false)

Parameters

pipeline Pipeline

The pipeline being configured.

defaultTimeout TimeSpan

The default timeout. When not infinite, the interceptor adds a deadline to requests without a deadline.

alwaysEnforceDeadline bool

When true and the request carries a deadline, the interceptor always creates a cancellation token source to enforce this deadline. When false and the request carries a deadline, the interceptor creates a cancellation token source to enforce this deadline only when the invocation's cancellation token cannot be canceled. The default value is false.

Returns

Pipeline

The pipeline being configured.

Examples

The following code adds the deadline interceptor to the invocation pipeline.

await using var connection = new ClientConnection(new Uri("icerpc://localhost"));

// Create an invocation pipeline, that uses the deadline interceptor and has a default timeout of 500 ms.
Pipeline pipeline = new Pipeline()
    .UseDeadline(defaultTimeout: TimeSpan.FromMilliseconds(500))
    .Into(connection);