Table of Contents

Class Mediator

Namespace
Savvyio.Extensions
Assembly
Savvyio.Extensions.Dispatchers.dll

Provides a default implementation of the IMediator interface.

public class Mediator : IMediator, ICommandDispatcher, IDomainEventDispatcher, IIntegrationEventDispatcher, IQueryDispatcher, IDispatcher
Inheritance
Mediator
Implements
Extension Methods

Constructors

Mediator(IServiceLocator)

Initializes a new instance of the Mediator class.

public Mediator(IServiceLocator serviceLocator)

Parameters

serviceLocator IServiceLocator

The provider of service implementations.

Methods

Commit(ICommand)

Commits the specified request using Fire-and-Forget/In-Only MEP.

public void Commit(ICommand request)

Parameters

request ICommand

The ICommand to commit.

CommitAsync(ICommand, Action<AsyncOptions>)

Commits the specified request asynchronous using Fire-and-Forget/In-Only MEP.

public Task CommitAsync(ICommand request, Action<AsyncOptions> setup = null)

Parameters

request ICommand

The ICommand to commit.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

Publish(IIntegrationEvent)

Publishes the specified request using Fire-and-Forget/In-Only MEP.

public void Publish(IIntegrationEvent request)

Parameters

request IIntegrationEvent

The IIntegrationEvent to publish.

PublishAsync(IIntegrationEvent, Action<AsyncOptions>)

Publishes the specified request asynchronous using Fire-and-Forget/In-Only MEP.

public Task PublishAsync(IIntegrationEvent request, Action<AsyncOptions> setup = null)

Parameters

request IIntegrationEvent

The IIntegrationEvent to publish.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

QueryAsync<TResult>(IQuery<TResult>, Action<AsyncOptions>)

Queries the specified request asynchronous using Request-Reply/In-Out MEP.

public Task<TResult> QueryAsync<TResult>(IQuery<TResult> request, Action<AsyncOptions> setup = null)

Parameters

request IQuery<TResult>

The IQuery<TResult> to request.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task<TResult>

A Task<TResult> that represents the asynchronous operation. The task result contains the outcome of the query operation.

Type Parameters

TResult

The type of the result to return.

Query<TResult>(IQuery<TResult>)

Queries the specified request using Request-Reply/In-Out MEP.

public TResult Query<TResult>(IQuery<TResult> request)

Parameters

request IQuery<TResult>

The IQuery<TResult> to request.

Returns

TResult

The outcome of the query operation.

Type Parameters

TResult

The type of the result to return.

Raise(IDomainEvent)

Raises the specified request using Fire-and-Forget/In-Only MEP.

public void Raise(IDomainEvent request)

Parameters

request IDomainEvent

The IDomainEvent to raise.

RaiseAsync(IDomainEvent, Action<AsyncOptions>)

Raises the specified request using Fire-and-Forget/In-Only MEP.

public Task RaiseAsync(IDomainEvent request, Action<AsyncOptions> setup = null)

Parameters

request IDomainEvent

The IDomainEvent to raise.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

See Also