Table of Contents

Class QueryPublisherExtensions

Namespace
Silverback.Messaging.Publishing
Assembly
Silverback.Core.Model.dll
public static class QueryPublisherExtensions
Inheritance
QueryPublisherExtensions
Inherited Members

Methods

ExecuteQueryAsync<TResult>(IPublisher, IQuery<TResult>, bool, CancellationToken)

Executes the specified query forwarding it to its subscribers via the message bus and the method will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).

public static ValueTask<TResult> ExecuteQueryAsync<TResult>(this IPublisher publisher, IQuery<TResult> queryMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)

Parameters

publisher IPublisher

The IPublisher.

queryMessage IQuery<TResult>

The query to be executed.

throwIfUnhandled bool

A boolean value indicating whether an exception must be thrown if no subscriber is handling the message.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

ValueTask<TResult>

A ValueTask<TResult> representing the asynchronous operation. The ValueTask result contains the query result.

Type Parameters

TResult

The type of the result that is expected to be returned by the subscribers.

ExecuteQueryAsync<TResult>(IPublisher, IQuery<TResult>, CancellationToken)

Executes the specified query forwarding it to its subscribers via the message bus and the method will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).

public static ValueTask<TResult> ExecuteQueryAsync<TResult>(this IPublisher publisher, IQuery<TResult> queryMessage, CancellationToken cancellationToken = default)

Parameters

publisher IPublisher

The IPublisher.

queryMessage IQuery<TResult>

The query to be executed.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

ValueTask<TResult>

A ValueTask<TResult> representing the asynchronous operation. The ValueTask result contains the query result.

Type Parameters

TResult

The type of the result that is expected to be returned by the subscribers.

ExecuteQuery<TResult>(IPublisher, IQuery<TResult>, bool)

Executes the specified query forwarding it to its subscribers via the message bus and the method will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).

public static TResult ExecuteQuery<TResult>(this IPublisher publisher, IQuery<TResult> queryMessage, bool throwIfUnhandled = true)

Parameters

publisher IPublisher

The IPublisher.

queryMessage IQuery<TResult>

The query to be executed.

throwIfUnhandled bool

A boolean value indicating whether an exception must be thrown if no subscriber is handling the message.

Returns

TResult

The query result.

Type Parameters

TResult

The type of the result that is expected to be returned by the subscribers.