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
commandMessageICommandThe command to be executed.
throwIfUnhandledboolA 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
commandMessageICommandThe command 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
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
commandMessageICommandThe command to be executed.
cancellationTokenCancellationTokenThe CancellationToken that can be used to cancel the operation.
Returns
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
commandMessageICommand<TResult>The command 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
- Task<TResult>
A Task<TResult> representing the asynchronous operation. The Task result contains the command result.
Type Parameters
TResultThe 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
commandMessageICommand<TResult>The command to be executed.
cancellationTokenCancellationTokenThe 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
TResultThe 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
commandMessageICommand<TResult>The command to be executed.
throwIfUnhandledboolA boolean value indicating whether an exception must be thrown if no subscriber is handling the message.
Returns
- TResult
The command result.
Type Parameters
TResultThe 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
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>(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
queryMessageIQuery<TResult>The query to be executed.
cancellationTokenCancellationTokenThe 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
TResultThe 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
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.
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
eventMessageIEventThe event to be published.
throwIfUnhandledboolA 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
eventMessageIEventThe event to be published.
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
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
eventMessageIEventThe event to be published.
cancellationTokenCancellationTokenThe CancellationToken that can be used to cancel the operation.