Esempio n. 1
0
        /// <summary>
        /// Instantiates a new instance of <see cref="BootProcedure" />
        /// </summary>
        /// <param name="systemsThatKnowAboutEventProcessors">Provides <see cref="IEventProcessor">Event Processors</see></param>
        /// <param name="tenants">A collection of all <see cref="ITenants">tenants</see></param>
        /// <param name="processingHub">An instance of <see cref="IScopedEventProcessingHub" /> for processing <see cref="CommittedEventStream">Committed Event Streams</see></param>
        /// <param name="getOffsetRepository">A factory function to return a correctly scoped instance of <see cref="IEventProcessorOffsetRepository" /></param>
        /// <param name="getUnprocessedEventsFetcher">A factory function to return a correctly scoped instance of <see cref="IFetchUnprocessedEvents" /></param>
        /// <param name="executionContextManager">The <see cref="ExecutionContextManager" /> for setting the correct execution context for the Event Processors </param>
        /// <param name="resourceConfiguration"></param>
        /// <param name="boundedContextLoader"></param>
        /// <param name="environment"></param>
        /// <param name="logger">An instance of <see cref="ILogger" /> for logging</param>
        public BootProcedure(
            IInstancesOf <IKnowAboutEventProcessors> systemsThatKnowAboutEventProcessors,
            ITenants tenants,
            IScopedEventProcessingHub processingHub,
            FactoryFor <IEventProcessorOffsetRepository> getOffsetRepository,
            FactoryFor <IFetchUnprocessedEvents> getUnprocessedEventsFetcher,
            IExecutionContextManager executionContextManager,
            IResourceConfiguration resourceConfiguration,
            IBoundedContextLoader boundedContextLoader,
            Execution.Environment environment,
            ILogger logger)
        {
            _processingHub = processingHub;
            _logger        = logger;
            _tenants       = tenants;
            _systemsThatKnowAboutEventProcessors = systemsThatKnowAboutEventProcessors;
            _getOffsetRepository         = getOffsetRepository;
            _getUnprocessedEventsFetcher = getUnprocessedEventsFetcher;
            _executionContextManager     = executionContextManager;
            _resourceConfiguration       = resourceConfiguration;
            _logger = logger;

            var boundedContextConfig = boundedContextLoader.Load();

            _executionContextManager.SetConstants(boundedContextConfig.Application, boundedContextConfig.BoundedContext, environment);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OriginalContext"/> class.
 /// </summary>
 /// <param name="application"><see cref="Applications.Application"/> that is the source of the event.</param>
 /// <param name="boundedContext"><see cref="BoundedContext"/> that is the source of the event.</param>
 /// <param name="tenant"><see cref="TenantId"/> that is related to the source of the event.</param>
 /// <param name="environment"><see cref="Dolittle.Execution.Environment"/> for the original <see cref="ExecutionContext"/>.</param>
 /// <param name="claims"><see cref="Claims"/> for the user who initiated the event.</param>
 /// <param name="commitSequenceNumber"><see cref="CommitSequenceNumber"/> for the commit of which this event is part.  May not be populated in the source Bounded Context.</param>
 public OriginalContext(
     Application application,
     BoundedContext boundedContext,
     TenantId tenant,
     Execution.Environment environment,
     Claims claims,
     CommitSequenceNumber commitSequenceNumber = null)
 {
     Application    = application;
     BoundedContext = boundedContext;
     Tenant         = tenant;
     Environment    = environment;
     Claims         = claims;
     CommitInOrigin = commitSequenceNumber ?? 0;
 }