Table of Contents

Interface ISender

Namespace
Caesar
Assembly
Caesar.Abstractions.dll

Sends requests to their single handler and creates response streams.

public interface ISender

Methods

CreateStream(object, CancellationToken)

Creates a stream for a streaming request whose type is only known at runtime. The object must implement IStreamRequest<TResponse>.

IAsyncEnumerable<object?> CreateStream(object request, CancellationToken cancellationToken = default)

Parameters

request object

The request.

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<object>

CreateStream<TResponse>(IStreamRequest<TResponse>, CancellationToken)

Creates a stream for a streaming request, running the stream pipeline.

IAsyncEnumerable<TResponse> CreateStream<TResponse>(IStreamRequest<TResponse> request, CancellationToken cancellationToken = default)

Parameters

request IStreamRequest<TResponse>

The request.

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<TResponse>

Type Parameters

TResponse

The item type.

Send(object, CancellationToken)

Sends a request whose type is only known at runtime. The object must implement IRequest<TResponse>; the response is returned as object.

Task<object?> Send(object request, CancellationToken cancellationToken = default)

Parameters

request object

The request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<object>

Send<TResponse>(IRequest<TResponse>, CancellationToken)

Sends a request and returns its response after running the pipeline.

Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default)

Parameters

request IRequest<TResponse>

The request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TResponse>

Type Parameters

TResponse

The response type.

Send<TRequest>(TRequest, CancellationToken)

Sends a command (a request without a response) after running the pipeline.

Task Send<TRequest>(TRequest request, CancellationToken cancellationToken = default) where TRequest : IRequest

Parameters

request TRequest

The request.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

Type Parameters

TRequest

The request type.