Table of Contents

Interface IApplicationPublisher

Namespace
Silverback.Messaging.Publishing
Assembly
Silverback.Core.Model.dll

Publishes messages via the message bus, forwarding them to the subscribers.

public interface IApplicationPublisher

Remarks

Extended by the IPublisher interface to add specific methods to publish ICommand/ICommand<TResult>, IQuery<TResult>, and IEvent messages.

Methods

ExecuteCommand(ICommand, bool)

Executes the specified command 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).

void ExecuteCommand(ICommand commandMessage, bool throwIfUnhandled = true)

Parameters

commandMessage ICommand

The command to be executed.

throwIfUnhandled bool

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

ExecuteCommandAsync(ICommand, bool, CancellationToken)

Executes the specified command 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).

Task ExecuteCommandAsync(ICommand commandMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)

Parameters

commandMessage ICommand

The command 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

Task

A Task representing the asynchronous operation.

ExecuteCommandAsync(ICommand, CancellationToken)

Executes the specified command 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).

Task ExecuteCommandAsync(ICommand commandMessage, CancellationToken cancellationToken = default)

Parameters

commandMessage ICommand

The command to be executed.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

Task

A Task representing the asynchronous operation.

ExecuteCommandAsync<TResult>(ICommand<TResult>, bool, CancellationToken)

Executes the specified command 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).

Task<TResult> ExecuteCommandAsync<TResult>(ICommand<TResult> commandMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)

Parameters

commandMessage ICommand<TResult>

The command 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

Task<TResult>

A Task<TResult> representing the asynchronous operation. The Task result contains the command result.

Type Parameters

TResult

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

ExecuteCommandAsync<TResult>(ICommand<TResult>, CancellationToken)

Executes the specified command 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).

Task<TResult> ExecuteCommandAsync<TResult>(ICommand<TResult> commandMessage, CancellationToken cancellationToken = default)

Parameters

commandMessage ICommand<TResult>

The command to be executed.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

Task<TResult>

A Task<TResult> representing the asynchronous operation. The Task result contains the command result.

Type Parameters

TResult

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

ExecuteCommand<TResult>(ICommand<TResult>, bool)

Executes the specified command 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).

TResult ExecuteCommand<TResult>(ICommand<TResult> commandMessage, bool throwIfUnhandled = true)

Parameters

commandMessage ICommand<TResult>

The command 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 command result.

Type Parameters

TResult

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

ExecuteQueryAsync<TResult>(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).

ValueTask<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> queryMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)

Parameters

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>(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).

ValueTask<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> queryMessage, CancellationToken cancellationToken = default)

Parameters

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 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>(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).

TResult ExecuteQuery<TResult>(IQuery<TResult> queryMessage, bool throwIfUnhandled = true)

Parameters

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.

PublishEvent(IEvent, bool)

Publishes the specified event 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).

void PublishEvent(IEvent eventMessage, bool throwIfUnhandled = false)

Parameters

eventMessage IEvent

The event to be published.

throwIfUnhandled bool

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

PublishEventAsync(IEvent, bool, CancellationToken)

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

Task PublishEventAsync(IEvent eventMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)

Parameters

eventMessage IEvent

The event to be published.

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

Task

A Task representing the asynchronous operation.

PublishEventAsync(IEvent, CancellationToken)

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

Task PublishEventAsync(IEvent eventMessage, CancellationToken cancellationToken = default)

Parameters

eventMessage IEvent

The event to be published.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

Task

A Task representing the asynchronous operation.