Table of Contents

Class RequestReplyDispatcher

Namespace
Savvyio.Dispatchers
Assembly
Savvyio.Core.dll

Provides a generic dispatcher that uses Request-Reply/In-Out MEP. This is an abstract class.

public abstract class RequestReplyDispatcher : Dispatcher, IDispatcher
Inheritance
Object
RequestReplyDispatcher
Implements
Derived
Inherited Members

Constructors

RequestReplyDispatcher(IServiceLocator)

Initializes a new instance of the RequestReplyDispatcher class.

protected RequestReplyDispatcher(IServiceLocator serviceLocator)

Parameters

serviceLocator IServiceLocator

The provider of service implementations.

Methods

Dispatch<TRequest, THandler, TResponse>(TRequest, Func<THandler, IRequestReplyActivator<TRequest>>)

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

protected virtual TResponse Dispatch<TRequest, THandler, TResponse>(TRequest request, Func<THandler, IRequestReplyActivator<TRequest>> handlerFactory)
    where TRequest : IRequest where THandler : IHandler<TRequest>

Parameters

request TRequest

The model that is being handled by a registered delegate.

handlerFactory Func<THandler, IRequestReplyActivator<TRequest>>

The function delegate that will locate and invoke the handler registered to the specified request.

Returns

TResponse

The response of the request.

Type Parameters

TRequest

The type of the input model registered to a handler.

THandler

The type of the handler to locate the input model.

TResponse

The type of the output model.

Remarks

A request can be a command, domain event, integration event, query etc.

DispatchAsync<TRequest, THandler, TResponse>(TRequest, Func<THandler, IRequestReplyActivator<TRequest>>, Action<AsyncOptions>)

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

protected virtual async Task<TResponse> DispatchAsync<TRequest, THandler, TResponse>(TRequest request, Func<THandler, IRequestReplyActivator<TRequest>> handlerFactory, Action<AsyncOptions> setup)
    where TRequest : IRequest where THandler : IHandler<TRequest>

Parameters

request TRequest

The model that is being handled by a registered delegate.

handlerFactory Func<THandler, IRequestReplyActivator<TRequest>>

The function delegate that will locate and invoke the handler registered to the specified request.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task<TResponse>

A task that represents the asynchronous operation. The task result contains the response of the request.

Type Parameters

TRequest

The type of the input model registered to a handler.

THandler

The type of the handler to locate the input model.

TResponse

The type of the output model.

Remarks

A request can be a command, domain event, integration event, query etc.

See Also