Show / Hide Table of Contents

    Class Publisher

    Publishes the messages to the internal bus.

    This is the actual mediator that forwards the messages being published to their subscribers.

    Inheritance
    object
    Publisher
    Implements
    IPublisher
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Silverback.Messaging.Publishing
    Assembly: Silverback.Core.dll
    Syntax
    public class Publisher : IPublisher

    Constructors

    | Improve this doc View source

    Publisher(IBehaviorsProvider, IServiceProvider, ISilverbackLogger<Publisher>)

    Initializes a new instance of the Publisher class.

    Declaration
    public Publisher(IBehaviorsProvider behaviorsProvider, IServiceProvider serviceProvider, ISilverbackLogger<Publisher> logger)
    Parameters
    Type Name Description
    IBehaviorsProvider behaviorsProvider

    The IBehaviorsProvider.

    IServiceProvider serviceProvider

    The IServiceProvider instance to be used to resolve the subscribers.

    ISilverbackLogger<Publisher> logger

    The ISilverbackLogger.

    Methods

    | Improve this doc View source

    Publish(object)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public void Publish(object message)
    Parameters
    Type Name Description
    object message

    The message to be published.

    | Improve this doc View source

    Publish(object, bool)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public void Publish(object message, bool throwIfUnhandled)
    Parameters
    Type Name Description
    object message

    The message to be published.

    bool throwIfUnhandled

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

    | Improve this doc View source

    PublishAsync(object)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public Task PublishAsync(object message)
    Parameters
    Type Name Description
    object message

    The message to be published.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    PublishAsync(object, bool)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public Task PublishAsync(object message, bool throwIfUnhandled)
    Parameters
    Type Name Description
    object message

    The message to be published.

    bool throwIfUnhandled

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

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    | Improve this doc View source

    PublishAsync<TResult>(object)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public Task<IReadOnlyCollection<TResult>> PublishAsync<TResult>(object message)
    Parameters
    Type Name Description
    object message

    The message to be published.

    Returns
    Type Description
    Task<IReadOnlyCollection<TResult>>

    A Task<TResult> representing the asynchronous operation. The task result contains a collection of TResult, since multiple subscribers could handle the message and return a value.

    Type Parameters
    Name Description
    TResult

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

    | Improve this doc View source

    PublishAsync<TResult>(object, bool)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public Task<IReadOnlyCollection<TResult>> PublishAsync<TResult>(object message, bool throwIfUnhandled)
    Parameters
    Type Name Description
    object message

    The message to be published.

    bool throwIfUnhandled

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

    Returns
    Type Description
    Task<IReadOnlyCollection<TResult>>

    A Task<TResult> representing the asynchronous operation. The task result contains a collection of TResult, since multiple subscribers could handle the message and return a value.

    Type Parameters
    Name Description
    TResult

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

    | Improve this doc View source

    Publish<TResult>(object)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public IReadOnlyCollection<TResult> Publish<TResult>(object message)
    Parameters
    Type Name Description
    object message

    The message to be published.

    Returns
    Type Description
    IReadOnlyCollection<TResult>

    A collection of TResult, since multiple subscribers could handle the message and return a value.

    Type Parameters
    Name Description
    TResult

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

    | Improve this doc View source

    Publish<TResult>(object, bool)

    Publishes the specified message to the internal bus. The message will be forwarded to its subscribers 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
    public IReadOnlyCollection<TResult> Publish<TResult>(object message, bool throwIfUnhandled)
    Parameters
    Type Name Description
    object message

    The message to be published.

    bool throwIfUnhandled

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

    Returns
    Type Description
    IReadOnlyCollection<TResult>

    A collection of TResult, since multiple subscribers could handle the message and return a value.

    Type Parameters
    Name Description
    TResult

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

    Implements

    IPublisher
    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini