Class QueryPublisherExtensions
- Namespace
- Silverback.Messaging.Publishing
- Assembly
- Silverback.Core.Model.dll
Adds the ExecuteQuery<TResult>(IPublisher, IQuery<TResult>, bool) and ExecuteQueryAsync<TResult>(IPublisher, IQuery<TResult>, CancellationToken) methods to the IPublisher interface.
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
publisherIPublisherThe IPublisher.
queryMessageIQuery<TResult>The query to be executed.
throwIfUnhandledboolA boolean value indicating whether an exception must be thrown if no subscriber is handling the message.
cancellationTokenCancellationTokenThe 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
TResultThe 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
publisherIPublisherThe IPublisher.
queryMessageIQuery<TResult>The query to be executed.
cancellationTokenCancellationTokenThe 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
TResultThe 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
publisherIPublisherThe IPublisher.
queryMessageIQuery<TResult>The query to be executed.
throwIfUnhandledboolA boolean value indicating whether an exception must be thrown if no subscriber is handling the message.
Returns
- TResult
The query result.
Type Parameters
TResultThe type of the result that is expected to be returned by the subscribers.