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
serviceLocatorIServiceLocatorThe provider of service implementations.
Methods
Commit(ICommand)
Commits the specified request using Fire-and-Forget/In-Only MEP.
public void Commit(ICommand request)
Parameters
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
requestICommandThe ICommand to commit.
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
Publish(IIntegrationEvent)
Publishes the specified request using Fire-and-Forget/In-Only MEP.
public void Publish(IIntegrationEvent request)
Parameters
requestIIntegrationEventThe 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
requestIIntegrationEventThe IIntegrationEvent to publish.
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
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
requestIQuery<TResult>The IQuery<TResult> to request.
setupAction<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
TResultThe 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
requestIQuery<TResult>The IQuery<TResult> to request.
Returns
- TResult
The outcome of the query operation.
Type Parameters
TResultThe 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
requestIDomainEventThe 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
requestIDomainEventThe IDomainEvent to raise.
setupAction<AsyncOptions>The AsyncOptions which may be configured.