Show / Hide Table of Contents

    Interface IApplicationPublisher

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

    Inherited Members
    IPublisher.Publish(object, bool)
    IPublisher.Publish<TResult>(object, bool)
    IPublisher.PublishAsync(object, CancellationToken)
    IPublisher.PublishAsync(object, bool, CancellationToken)
    IPublisher.PublishAsync<TResult>(object, CancellationToken)
    IPublisher.PublishAsync<TResult>(object, bool, CancellationToken)
    IPublisher.Context
    Namespace: Silverback.Messaging.Publishing
    Assembly: Silverback.Core.Model.dll
    Syntax
    public interface IApplicationPublisher : IPublisher
    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).

    Declaration
    void ExecuteCommand(ICommand commandMessage, bool throwIfUnhandled = true)
    Parameters
    Type Name Description
    ICommand commandMessage

    The command to be executed.

    bool throwIfUnhandled

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

    Remarks

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

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

    Declaration
    Task ExecuteCommandAsync(ICommand commandMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ICommand commandMessage

    The command to be executed.

    bool throwIfUnhandled

    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
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

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

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

    Declaration
    Task ExecuteCommandAsync(ICommand commandMessage, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ICommand commandMessage

    The command to be executed.

    CancellationToken cancellationToken

    The CancellationToken that can be used to cancel the operation.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

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

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

    Declaration
    Task<TResult> ExecuteCommandAsync<TResult>(ICommand<TResult> commandMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ICommand<TResult> commandMessage

    The command to be executed.

    bool throwIfUnhandled

    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
    Type Description
    Task<TResult>

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

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    Task<TResult> ExecuteCommandAsync<TResult>(ICommand<TResult> commandMessage, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ICommand<TResult> commandMessage

    The command to be executed.

    CancellationToken cancellationToken

    The CancellationToken that can be used to cancel the operation.

    Returns
    Type Description
    Task<TResult>

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

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    TResult ExecuteCommand<TResult>(ICommand<TResult> commandMessage, bool throwIfUnhandled = true)
    Parameters
    Type Name Description
    ICommand<TResult> commandMessage

    The command to be executed.

    bool throwIfUnhandled

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

    Returns
    Type Description
    TResult

    The command result.

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    ValueTask<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> queryMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IQuery<TResult> queryMessage

    The query to be executed.

    bool throwIfUnhandled

    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
    Type Description
    ValueTask<TResult>

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

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    ValueTask<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> queryMessage, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IQuery<TResult> queryMessage

    The query to be executed.

    CancellationToken cancellationToken

    The CancellationToken that can be used to cancel the operation.

    Returns
    Type Description
    ValueTask<TResult>

    A ValueTask representing the asynchronous operation. The ValueTask result contains the query result.

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    TResult ExecuteQuery<TResult>(IQuery<TResult> queryMessage, bool throwIfUnhandled = true)
    Parameters
    Type Name Description
    IQuery<TResult> queryMessage

    The query to be executed.

    bool throwIfUnhandled

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

    Returns
    Type Description
    TResult

    The query result.

    Type Parameters
    Name Description
    TResult

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

    Remarks

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

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

    Declaration
    void PublishEvent(IEvent eventMessage, bool throwIfUnhandled = false)
    Parameters
    Type Name Description
    IEvent eventMessage

    The event to be published.

    bool throwIfUnhandled

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

    Remarks

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

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

    Declaration
    Task PublishEventAsync(IEvent eventMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IEvent eventMessage

    The event to be published.

    bool throwIfUnhandled

    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
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

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

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

    Declaration
    Task PublishEventAsync(IEvent eventMessage, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IEvent eventMessage

    The event to be published.

    CancellationToken cancellationToken

    The CancellationToken that can be used to cancel the operation.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Remarks

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

    Extension Methods

    CommandPublisherExtensions.ExecuteCommand(IPublisher, ICommand, bool)
    CommandPublisherExtensions.ExecuteCommandAsync(IPublisher, ICommand, bool, CancellationToken)
    CommandPublisherExtensions.ExecuteCommandAsync(IPublisher, ICommand, CancellationToken)
    CommandPublisherExtensions.ExecuteCommandAsync<TResult>(IPublisher, ICommand<TResult>, bool, CancellationToken)
    CommandPublisherExtensions.ExecuteCommandAsync<TResult>(IPublisher, ICommand<TResult>, CancellationToken)
    CommandPublisherExtensions.ExecuteCommand<TResult>(IPublisher, ICommand<TResult>, bool)
    EventPublisherExtensions.PublishEvent(IPublisher, IEvent, bool)
    EventPublisherExtensions.PublishEventAsync(IPublisher, IEvent, bool, CancellationToken)
    EventPublisherExtensions.PublishEventAsync(IPublisher, IEvent, CancellationToken)
    QueryPublisherExtensions.ExecuteQueryAsync<TResult>(IPublisher, IQuery<TResult>, bool, CancellationToken)
    QueryPublisherExtensions.ExecuteQueryAsync<TResult>(IPublisher, IQuery<TResult>, CancellationToken)
    QueryPublisherExtensions.ExecuteQuery<TResult>(IPublisher, IQuery<TResult>, bool)
    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini