CQRS.NET  2.1
A lightweight enterprise framework to write CQRS, event-sourced and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.
Cqrs.Bus.InProcessBus< TAuthenticationToken > Class Template Reference

An in process command bus (ICommandPublisher<TAuthenticationToken> and ICommandReceiver<TAuthenticationToken>) event bus (IEventPublisher<TAuthenticationToken> and IEventHandler<TAuthenticationToken,TTarget,TEvent>) as well as a IEventHandlerRegistrar and ICommandHandlerRegistrar that requires no networking. More...

+ Inheritance diagram for Cqrs.Bus.InProcessBus< TAuthenticationToken >:

Public Member Functions

 InProcessBus (IAuthenticationTokenHelper< TAuthenticationToken > authenticationTokenHelper, ICorrelationIdHelper correlationIdHelper, IDependencyResolver dependencyResolver, ILogger logger, IConfigurationManager configurationManager, IBusHelper busHelper)
 Instantiates a new instance of the InProcessBus<TAuthenticationToken> class. More...
 
virtual void Send< TCommand > (TCommand command)
 Publishes the provided command on the command bus. More...
 
virtual void Send< TCommand > (IEnumerable< TCommand > commands)
 Publishes the provided commands on the command bus. More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits for an event of TEvent More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, int millisecondsTimeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, TimeSpan timeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits until the specified condition is satisfied an event of TEvent More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, int millisecondsTimeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
virtual TEvent SendAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, TimeSpan timeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Sends the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
virtual void Publish< TEvent > (TEvent @event)
 Publishes the provided @event on the event bus. More...
 
virtual void Publish< TEvent > (IEnumerable< TEvent > events)
 Publishes the provided events on the event bus. More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits for an event of TEvent More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, int millisecondsTimeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, TimeSpan timeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits until the specified condition is satisfied an event of TEvent More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, int millisecondsTimeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
TEvent PublishAndWait< TCommand, TEvent > (TCommand command, Func< IEnumerable< IEvent< TAuthenticationToken >>, TEvent > condition, TimeSpan timeout, IEventReceiver< TAuthenticationToken > eventReceiver=null)
 Publishes the provided command and waits for an event of TEvent or exits if the specified timeout is expired. More...
 
virtual void RegisterHandler< TMessage > (Action< TMessage > handler, Type targetedType, bool holdMessageLock=true)
 Register an event or command handler that will listen and respond to events or commands. More...
 
virtual void RegisterHandler< TMessage > (Action< TMessage > handler, bool holdMessageLock=true)
 Register an event or command handler that will listen and respond to events or commands. More...
 
virtual bool ReceiveCommand (ICommand< TAuthenticationToken > command)
 Receives a ICommand<TAuthenticationToken> from the command bus. More...
 
virtual bool ReceiveEvent (IEvent< TAuthenticationToken > @event)
 Receives an IEvent<TAuthenticationToken> from the event bus. More...
 

Protected Member Functions

virtual void PrepareCommand< TCommand > (TCommand command)
 Sets the IMessageWithAuthenticationToken<TAuthenticationToken>.AuthenticationToken, IMessage.CorrelationId, ICommand<TAuthenticationToken>.OriginatingFramework to "Built-In" and adds a value of "Built-In" to the IMessage.Frameworks if not already done so More...
 
virtual bool PrepareAndValidateCommand< TCommand > (TCommand command, out RouteHandlerDelegate commandHandler)
 Locates a suitable ICommandValidator<TAuthenticationToken,TCommand> to validate the provided command and validates the provided command if one is located Calls PrepareCommand<TCommand> Checks if the provided command is required to be processed Locates a single command handler for the provided command More...
 

Properties

IAuthenticationTokenHelper< TAuthenticationToken > AuthenticationTokenHelper [get]
 Gets or sets the Authentication Token Helper More...
 
ICorrelationIdHelper CorrelationIdHelper [get]
 Gets or sets the CorrelationId Helper More...
 
IDependencyResolver DependencyResolver [get]
 Gets or sets the Dependency Resolver More...
 
ILogger Logger [get]
 Gets or sets the Logger More...
 
IConfigurationManager ConfigurationManager [get]
 Gets or sets the Configuration Manager More...
 
IBusHelper BusHelper [get]
 Gets or sets the Bus Helper More...
 
IDictionary< Guid, IList< IEvent< TAuthenticationToken > > > EventWaits [get]
 Gets or sets the current list of events waiting to be evaluated for PublishAndWait<TCommand,TEvent>(TCommand,Cqrs.Events.IEventReceiver<TAuthenticationToken>) More...
 
ITelemetryHelper TelemetryHelper [get, set]
 Gets or sets the Telemetry Helper More...
 

Detailed Description

An in process command bus (ICommandPublisher<TAuthenticationToken> and ICommandReceiver<TAuthenticationToken>) event bus (IEventPublisher<TAuthenticationToken> and IEventHandler<TAuthenticationToken,TTarget,TEvent>) as well as a IEventHandlerRegistrar and ICommandHandlerRegistrar that requires no networking.

Template Parameters
TAuthenticationToken