Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connector"></param>
 /// <param name="serializer"></param>
 /// <param name="artifactTypeMap"></param>
 public EventStore(EventStoreConnector connector, ISerializer serializer, IArtifactTypeMap artifactTypeMap)
 {
     _streamPrefix    = $"{connector.Instance}";
     _connection      = connector.Connection;
     _serializer      = serializer;
     _artifactTypeMap = artifactTypeMap;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventConverter"/> class.
 /// </summary>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping types and artifacts.</param>
 /// <param name="serializer"><see cref="ISerializer"/> for serialization.</param>
 public EventConverter(
     IArtifactTypeMap artifactTypeMap,
     ISerializer serializer)
 {
     _artifactTypeMap = artifactTypeMap;
     _serializer      = serializer;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueriesController"/> class.
 /// </summary>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts and types.</param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> for creating instances of types.</param>
 /// <param name="coordinator"><see cref="IQueryCoordinator"/> for executing queries.</param>
 public QueriesController(
     IArtifactTypeMap artifactTypeMap,
     IObjectFactory objectFactory,
     IQueryCoordinator coordinator)
 {
     _artifactTypeMap = artifactTypeMap;
     _objectFactory   = objectFactory;
     _coordinator     = coordinator;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandsController"/> class.
 /// </summary>
 /// <param name="artifactTypeMap">A <see cref="IArtifactTypeMap"/> for mappnig between artifacts and types.</param>
 /// <param name="objectFactory">A <see cref="IObjectFactory"/> for creating instances of types.</param>
 /// <param name="coordinator">A <see cref="ICommandCoordinator"/> for coordinating commands.</param>
 public CommandsController(
     IArtifactTypeMap artifactTypeMap,
     IObjectFactory objectFactory,
     ICommandCoordinator coordinator)
 {
     _artifactTypeMap = artifactTypeMap;
     _objectFactory   = objectFactory;
     _coordinator     = coordinator;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ArtifactMapper{T}"/> class.
        /// </summary>
        /// <param name="topology"><see cref="Topology"/> configuration.</param>
        /// <param name="artifacts">The <see cref="ArtifactsConfiguration"/>.</param>
        /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts and types.</param>
        public ArtifactMapper(
            Topology topology,
            ArtifactsConfiguration artifacts,
            IArtifactTypeMap artifactTypeMap)
        {
            _topology        = topology;
            _artifacts       = artifacts;
            _artifactTypeMap = artifactTypeMap;

            _artifactsByPath = new Dictionary <string, Type>();
            BuildMapOfAllCorrespondingArtifacts();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ArtifactMapper{T}"/> class.
        /// </summary>
        /// <param name="topology"><see cref="Topology"/> configuration.</param>
        /// <param name="artifacts">The <see cref="ArtifactsConfiguration"/>.</param>
        /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts and types.</param>
        public ArtifactMapper(
            Topology topology,
            ArtifactsConfiguration artifacts,
            IArtifactTypeMap artifactTypeMap)
        {
            _topology        = topology;
            _artifacts       = artifacts;
            _artifactTypeMap = artifactTypeMap;

            _artifactPaths = new Dictionary <Type, PathString>();
            BuildMapOfArtifacts();
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of <see cref="AggregateRootRepositoryFor{T}">AggregatedRootRepository</see>
 /// </summary>
 /// <param name="commandContextManager"> <see cref="ICommandContextManager"/> to use for tracking </param>
 /// <param name="eventStore"><see cref="IEventStore"/> for getting <see cref="IEvent">events</see></param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for being able to identify resources</param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> to construct an instance of a Type from a <see cref="PropertyBag" /></param>
 /// <param name="logger"><see cref="ILogger"/> to use for logging</param>
 public AggregateRootRepositoryFor(
     ICommandContextManager commandContextManager,
     IEventStore eventStore,
     IArtifactTypeMap artifactTypeMap,
     IObjectFactory objectFactory,
     ILogger logger)
 {
     _commandContextManager = commandContextManager;
     _eventStore            = eventStore;
     _artifactTypeMap       = artifactTypeMap;
     _logger        = logger;
     _objectFactory = objectFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandsController"/> class.
 /// </summary>
 /// <param name="artifactTypes"><see cref="IArtifactMapper{T}"/> for mapping commands.</param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> for creating instances of commands.</param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts to types.</param>
 /// <param name="commandCoordinator"><see cref="ICommandCoordinator"/> for coordinating commands.</param>
 /// <param name="serializer">JSON <see cref="ISerializer"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> to use.</param>
 public CommandsController(
     IArtifactMapper <ICommand> artifactTypes,
     IObjectFactory objectFactory,
     IArtifactTypeMap artifactTypeMap,
     ICommandCoordinator commandCoordinator,
     ISerializer serializer,
     ILogger logger)
     : base(artifactTypes, objectFactory, logger)
 {
     _artifactTypeMap    = artifactTypeMap;
     _commandCoordinator = commandCoordinator;
     _serializer         = serializer;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventInjector"/> class.
 /// </summary>
 /// <param name="getEventStore"><see cref="FactoryFor{IEventStore}" /> factory function that returns a correctly scoped <see cref="IEventStore" />.</param>
 /// <param name="processingHub"><see cref="IScopedEventProcessingHub" /> for processing events from the <see cref="CommittedEventStream" />.</param>
 /// <param name="executionContextManager"><see cref="IExecutionContextManager"/> for working with <see cref="ExecutionContext"/>.</param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts and types.</param>
 /// <param name="logger"><see cref="ILogger" /> for logging.</param>
 public EventInjector(
     FactoryFor <IEventStore> getEventStore,
     IScopedEventProcessingHub processingHub,
     IExecutionContextManager executionContextManager,
     IArtifactTypeMap artifactTypeMap,
     ILogger logger)
 {
     _getEventStore           = getEventStore;
     _processingHub           = processingHub;
     _executionContextManager = executionContextManager;
     _artifactTypeMap         = artifactTypeMap;
     _logger = logger;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueriesController"/> class.
 /// </summary>
 /// <param name="artifactTypes"><see cref="IArtifactMapper{T}"/> for mapping queries.</param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> for creating instances of queries.</param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts to types.</param>
 /// <param name="queryCoordinator"><see cref="IQueryCoordinator"/> for coordinating execution of queries.</param>
 /// <param name="serializer">JSON <see cref="ISerializer"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> to use.</param>
 public QueriesController(
     IArtifactMapper <IQuery> artifactTypes,
     IObjectFactory objectFactory,
     IArtifactTypeMap artifactTypeMap,
     IQueryCoordinator queryCoordinator,
     ISerializer serializer,
     ILogger logger)
     : base(artifactTypes, objectFactory, logger)
 {
     _artifactTypeMap  = artifactTypeMap;
     _queryCoordinator = queryCoordinator;
     _serializer       = serializer;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandHandlerInvoker"/> class.
 /// </summary>
 /// <param name="typeFinder">A <see cref="ITypeFinder"/> to use for discovering <see cref="ICanHandleCommands">command handlers</see>.</param>
 /// <param name="container">A <see cref="IContainer"/> to use for getting instances of objects.</param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for identifying resources.</param>
 /// <param name="converter"><see cref="ICommandRequestToCommandConverter"/> for converting to actual <see cref="ICommand"/> instances.</param>
 /// <param name="logger"><see cref="ILogger"/> used for logging.</param>
 public CommandHandlerInvoker(
     ITypeFinder typeFinder,
     IContainer container,
     IArtifactTypeMap artifactTypeMap,
     ICommandRequestToCommandConverter converter,
     ILogger logger)
 {
     _typeFinder      = typeFinder;
     _container       = container;
     _artifactTypeMap = artifactTypeMap;
     _converter       = converter;
     _logger          = logger;
     _initialized     = false;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="ProcessMethodEventProcessors"/>
 /// </summary>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for identifying <see cref="IEvent">events</see> </param>
 /// <param name="objectFactory"><see cref="IObjectFactory"/> for going between <see cref="PropertyBag"/> and instances of types</param>
 /// <param name="processors"><see cref="IImplementationsOf{ICanProcessEvents}"/> for discovering implementations of <see cref="ICanProcessEvents"/></param>
 /// <param name="container"><see cref="IContainer"/> for the implementation <see cref="ProcessMethodEventProcessor"/> when acquiring instances of implementations of <see cref="ICanProcessEvents"/></param>
 /// <param name="systemClock"><see cref="ISystemClock"/> for timing <see cref="IEventProcessors"/></param>
 /// <param name="logger"><see cref="ILogger"/> for logging</param>
 public ProcessMethodEventProcessors(
     IArtifactTypeMap artifactTypeMap,
     IObjectFactory objectFactory,
     IImplementationsOf <ICanProcessEvents> processors,
     IContainer container,
     ISystemClock systemClock,
     ILogger logger)
 {
     _artifactTypeMap = artifactTypeMap;
     _processors      = processors;
     _container       = container;
     _systemClock     = systemClock;
     _logger          = logger;
     _objectFactory   = objectFactory;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStore"/> class.
 /// </summary>
 /// <param name="eventStoreClient">The event store grpc client.</param>
 /// <param name="artifactMap">The <see cref="IArtifactTypeMap" />.</param>
 /// <param name="eventConverter">The <see cref="IEventConverter" />.</param>
 /// <param name="executionContextManager">An <see cref="IExecutionContextManager"/> for getting execution context from.</param>
 /// <param name="head">The current <see cref="Head"/>.</param>
 /// <param name="logger">The <see cref="ILogger" />.</param>
 public EventStore(
     EventStoreClient eventStoreClient,
     IArtifactTypeMap artifactMap,
     IEventConverter eventConverter,
     IExecutionContextManager executionContextManager,
     Head head,
     ILogger logger)
 {
     _artifactMap             = artifactMap;
     _eventStoreClient        = eventStoreClient;
     _eventConverter          = eventConverter;
     _executionContextManager = executionContextManager;
     _head   = head;
     _logger = logger;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventHandlerProcessors"/> class.
 /// </summary>
 /// <param name="handlersClient">The <see cref="EventHandlersClient"/> to use to connect to the Runtime.</param>
 /// <param name="reverseCallClients">The <see cref="IReverseCallClients"/> to use for creating instances of <see cref="IReverseCallClient{TClientMessage, TServerMessage, TConnectArguments, TConnectResponse, TRequest, TResponse}"/>.</param>
 /// <param name="eventProcessingCompletion">The <see cref="IEventProcessingCompletion"/> to use for notifying of event handling completion.</param>
 /// <param name="artifactTypeMap">The <see cref="IArtifactTypeMap"/> to use for converting event types to artifacts.</param>
 /// <param name="converter">The <see cref="IEventConverter"/> to use to convert events.</param>
 /// <param name="loggerManager">The <see cref="ILoggerManager"/> to use for creating instances of <see cref="ILogger"/>.</param>
 public EventHandlerProcessors(
     EventHandlersClient handlersClient,
     IReverseCallClients reverseCallClients,
     IEventProcessingCompletion eventProcessingCompletion,
     IArtifactTypeMap artifactTypeMap,
     IEventConverter converter,
     ILoggerManager loggerManager)
 {
     _handlersClient            = handlersClient;
     _reverseCallClients        = reverseCallClients;
     _eventProcessingCompletion = eventProcessingCompletion;
     _artifactTypeMap           = artifactTypeMap;
     _converter     = converter;
     _loggerManager = loggerManager;
 }
        /// <summary>
        /// Initializes an instance of a <see cref="UncommittedEventStreamCoordinator"/>
        /// </summary>
        /// <param name="getEventStore">A <see cref="FactoryFor{IEventStore}" /> to return a correctly scoped instance of <see cref="IEventStore" /></param>
        /// <param name="eventProcessorHub"><see cref="IScopedEventProcessingHub"/> for processing in same bounded context</param>
        /// <param name="eventHorizon"><see cref="IEventHorizon"/> to pass events through to</param>
        /// <param name="artifactMap">An instance of <see cref="IArtifactTypeMap" /> to get the artifact for Event Source and Events</param>
        /// <param name="logger"><see cref="ILogger"/> for doing logging</param>
        /// <param name="systemClock"><see cref="ISystemClock"/> for getting the time</param>
        /// <param name="executionContextManager"><see cref="IExecutionContextManager"/> for accessing the current <see cref="ExecutionContext" /></param>

        public UncommittedEventStreamCoordinator(
            FactoryFor <IEventStore> getEventStore,
            IScopedEventProcessingHub eventProcessorHub,
            IEventHorizon eventHorizon,
            IArtifactTypeMap artifactMap,
            ILogger logger,
            ISystemClock systemClock,
            IExecutionContextManager executionContextManager)

        {
            _getEventStore           = getEventStore;
            _eventProcessorHub       = eventProcessorHub;
            _eventHorizon            = eventHorizon;
            _logger                  = logger;
            _artifactMap             = artifactMap;
            _systemClock             = systemClock;
            _executionContextManager = executionContextManager;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventHandlerProcessor{TEventType}"/> class.
 /// </summary>
 /// <param name="handlerId">The unique <see cref="EventHandlerId"/> for the event handler.</param>
 /// <param name="scope">The <see cref="ScopeId"/> of the scope in the Event Store where the event handler will run.</param>
 /// <param name="partitioned">Whether the event handler should create a partitioned stream or not.</param>
 /// <param name="handler">The <see cref="IEventHandler{TEventType}"/> that will be called to handle incoming events.</param>
 /// <param name="client">The <see cref="EventHandlersClient"/> to use to connect to the Runtime.</param>
 /// <param name="reverseCallClients">The <see cref="IReverseCallClients"/> to use for creating instances of <see cref="IReverseCallClient{TClientMessage, TServerMessage, TConnectArguments, TConnectResponse, TRequest, TResponse}"/>.</param>
 /// <param name="completion">The <see cref="IEventProcessingCompletion"/> to use for notifying of event handling completion.</param>
 /// <param name="artifacts">The <see cref="IArtifactTypeMap"/> to use for converting event types to artifacts.</param>
 /// <param name="converter">The <see cref="IEventConverter"/> to use to convert events.</param>
 /// <param name="logger">The <see cref="ILogger"/> to use for logging.</param>
 public EventHandlerProcessor(
     EventHandlerId handlerId,
     ScopeId scope,
     bool partitioned,
     IEventHandler <TEventType> handler,
     EventHandlersClient client,
     IReverseCallClients reverseCallClients,
     IEventProcessingCompletion completion,
     IArtifactTypeMap artifacts,
     IEventConverter converter,
     ILogger logger)
     : base(logger)
 {
     Identifier          = handlerId;
     _scope              = scope;
     _partitioned        = partitioned;
     _handler            = handler;
     _client             = client;
     _reverseCallClients = reverseCallClients;
     _completion         = completion;
     _artifacts          = artifacts;
     _converter          = converter;
     _logger             = logger;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of <see cref="EventInjectorController"/>
 /// </summary>
 /// <param name="injector">The underlying <see cref="IEventInjector"/></param>
 /// <param name="objectFactory"></param>
 /// <param name="artifactTypeMap"></param>
 public EventInjectorController(IEventInjector injector, IObjectFactory objectFactory, IArtifactTypeMap artifactTypeMap)
 {
     _injector        = injector;
     _objectFactory   = objectFactory;
     _artifactTypeMap = artifactTypeMap;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandRequestToCommandConverter"/> class.
 /// </summary>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping between types and artifacts.</param>
 /// <param name="serializer"><see cref="ISerializer"/> for serialization.</param>
 /// <param name="logger">The <see cref="ILogger" />.</param>
 public CommandRequestToCommandConverter(IArtifactTypeMap artifactTypeMap, ISerializer serializer, ILogger logger)
 {
     _artifactTypeMap = artifactTypeMap;
     _serializer      = serializer;
     _logger          = logger;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of <see cref="BootProcedure"/>
 /// </summary>
 /// <param name="artifactsConfiguration">The <see cref="ArtifactsConfiguration"/> </param>
 /// <param name="artifactTypeMap"></param>
 public BootProcedure(ArtifactsConfiguration artifactsConfiguration, IArtifactTypeMap artifactTypeMap)
 {
     _artifacts       = artifactsConfiguration;
     _artifactTypeMap = artifactTypeMap;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandToCommandRequestConverter"/> class.
 /// </summary>
 /// <param name="artifactsTypeMap">The <see cref="IArtifactTypeMap"/> for identifying artifacts.</param>
 /// <param name="serializer"><see cref="ISerializer"/>.</param>
 public CommandToCommandRequestConverter(IArtifactTypeMap artifactsTypeMap, ISerializer serializer)
 {
     _artifactsTypeMap = artifactsTypeMap;
     _serializer       = serializer;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InjectEventRequestBinder"/> class.
 /// </summary>
 /// <param name="serializer"><see cref="ISerializer"/> to use.</param>
 /// <param name="artifactTypeMap"><see cref="IArtifactTypeMap"/> for mapping artifacts and types.</param>
 public InjectEventRequestBinder(ISerializer serializer, IArtifactTypeMap artifactTypeMap)
 {
     _serializer      = serializer;
     _artifactTypeMap = artifactTypeMap;
 }