Class CoreHost<TAuthenticationToken>
Configure and start command and event handlers in a host
Inheritance
Inherited Members
Namespace: Cqrs.Hosts
Assembly: Cqrs.dll
Syntax
public abstract class CoreHost<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken |
Constructors
CoreHost()
Instantiate a new instance of a CoreHost<TAuthenticationToken>
Declaration
protected CoreHost()
Properties
CommandBus
The ICommandReceiver that will be configured to receive ICommand<TAuthenticationToken>.
Declaration
protected ICommandReceiver<TAuthenticationToken> CommandBus { get; }
Property Value
Type | Description |
---|---|
ICommandReceiver<TAuthenticationToken> |
ConfigurationManager
The IConfigurationManager that can be use before the Current is set.
Declaration
protected abstract IConfigurationManager ConfigurationManager { get; }
Property Value
Type | Description |
---|---|
IConfigurationManager |
CorrelationIdHelper
The cdmdotnet.Logging.ICorrelationIdHelper that will be used when starting and stopping the host.
Declaration
protected ICorrelationIdHelper CorrelationIdHelper { get; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ICorrelationIdHelper |
EventBus
The IEventReceiver that will be configured to receive IEvent<TAuthenticationToken>.
Declaration
protected IEventReceiver<TAuthenticationToken> EventBus { get; }
Property Value
Type | Description |
---|---|
IEventReceiver<TAuthenticationToken> |
HandlerTypes
Each System.Type will be traced back to it's assembly, and that assembly will be scanned for other handlers to auto register.
Declaration
protected Type[] HandlerTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Type[] |
Logger
The cdmdotnet.Logging.ILogger that will be used when starting and stopping the host.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
TelemetryName
The hosts telemetry name if telemetry is configured
Declaration
protected string TelemetryName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
ConfigureDefaultDependencyResolver()
Configure the DependencyResolver.
Declaration
protected abstract void ConfigureDefaultDependencyResolver()
ConfigureTelemetry()
When overridden, allows you to configure Telemetry
Declaration
protected virtual void ConfigureTelemetry()
ManuallyRegisterCommandHandler<TMessage>(Action<TMessage>, Boolean)
Register an command handler that will listen and respond to commands.
Declaration
protected virtual void ManuallyRegisterCommandHandler<TMessage>(Action<TMessage> commandHandler, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | commandHandler | The command handler to call |
System.Boolean | holdMessageLock | If false, this will spin off another thread. This is a bad performance impact. Strongly suggest you use lock renewing instead... which is configuration based... so even better. |
Type Parameters
Name | Description |
---|---|
TMessage |
ManuallyRegisterEventHandler<TMessage>(Action<TMessage>, Boolean)
Register an event handler that will listen and respond to events.
Declaration
protected virtual void ManuallyRegisterEventHandler<TMessage>(Action<TMessage> eventHandler, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | eventHandler | The event handler to call |
System.Boolean | holdMessageLock | If false, this will spin off another thread. This is a bad performance impact. Strongly suggest you use lock renewing instead... which is configuration based... so even better. |
Type Parameters
Name | Description |
---|---|
TMessage |
Prepare()
Prepare the host before registering handlers and starting the host.
Declaration
protected virtual void Prepare()
PrepareSecurityProtocol()
Sets the System.Net.ServicePointManager.SecurityProtocol to System.Net.SecurityProtocolType.Tls. You might want to override this to .net 4.5 and above to SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls
Declaration
protected virtual void PrepareSecurityProtocol()
Run(Action)
Declaration
public virtual void Run(Action handlerRegistation = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action | handlerRegistation |
Start()
Start the host post preparing and registering handlers.
Declaration
protected virtual void Start()
StartBusRegistrar()
Start the BusRegistrar by calling Register(Type[]) passing HandlerTypes
Declaration
protected virtual void StartBusRegistrar()