コード例 #1
0
 public PortfolioStorage(
     IAggregateStorage aggregateStorage,
     IBlobStorage blobStorage)
 {
     _aggregateStorage = aggregateStorage;
     _blobStorage      = blobStorage;
 }
コード例 #2
0
 public CreateResearchCaseUseCase(
     IAggregateStorage <ResearchCase> researchCaseStorage,
     ILogger <CreateResearchCaseUseCase> logger)
 {
     _researchCaseStorage = researchCaseStorage;
     _logger = logger;
 }
コード例 #3
0
ファイル: DefaultEventService.cs プロジェクト: ulswww/enode
 public DefaultEventService(
     IJsonSerializer jsonSerializer,
     IScheduleService scheduleService,
     ITypeNameProvider typeNameProvider,
     IMemoryCache memoryCache,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateStorage aggregateStorage,
     IEventStore eventStore,
     IMessagePublisher<DomainEventStreamMessage> domainEventPublisher,
     IOHelper ioHelper,
     ILoggerFactory loggerFactory)
 {
     _eventMailboxDict = new ConcurrentDictionary<string, EventMailBox>();
     _ioHelper = ioHelper;
     _jsonSerializer = jsonSerializer;
     _scheduleService = scheduleService;
     _typeNameProvider = typeNameProvider;
     _memoryCache = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateStorage = aggregateStorage;
     _eventStore = eventStore;
     _domainEventPublisher = domainEventPublisher;
     _logger = loggerFactory.Create(GetType().FullName);
     _batchSize = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;
 }
コード例 #4
0
        public DefaultEventCommittingService(
            IJsonSerializer jsonSerializer,
            IScheduleService scheduleService,
            ITypeNameProvider typeNameProvider,
            IMemoryCache memoryCache,
            IAggregateRootFactory aggregateRootFactory,
            IAggregateStorage aggregateStorage,
            IEventStore eventStore,
            IMessagePublisher <DomainEventStreamMessage> domainEventPublisher,
            IOHelper ioHelper,
            ILoggerFactory loggerFactory)
        {
            _eventCommittingContextMailBoxList = new List <EventCommittingContextMailBox>();
            _ioHelper             = ioHelper;
            _jsonSerializer       = jsonSerializer;
            _scheduleService      = scheduleService;
            _typeNameProvider     = typeNameProvider;
            _memoryCache          = memoryCache;
            _aggregateRootFactory = aggregateRootFactory;
            _aggregateStorage     = aggregateStorage;
            _eventStore           = eventStore;
            _domainEventPublisher = domainEventPublisher;
            _logger            = loggerFactory.Create(GetType().FullName);
            _eventMailboxCount = ENodeConfiguration.Instance.Setting.EventMailBoxCount;
            _batchSize         = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;
            _timeoutSeconds    = ENodeConfiguration.Instance.Setting.AggregateRootMaxInactiveSeconds;
            _taskName          = "CleanInactiveAggregates_" + DateTime.Now.Ticks + new Random().Next(10000);

            for (var i = 0; i < _eventMailboxCount; i++)
            {
                _eventCommittingContextMailBoxList.Add(new EventCommittingContextMailBox(i, _batchSize, BatchPersistEventCommittingContexts, _logger));
            }
        }
コード例 #5
0
        public DefaultEventCommittingService(
            IJsonSerializer jsonSerializer,
            IScheduleService scheduleService,
            ITypeNameProvider typeNameProvider,
            IMemoryCache memoryCache,
            IAggregateRootFactory aggregateRootFactory,
            IAggregateStorage aggregateStorage,
            IEventStore eventStore,
            IMessagePublisher <DomainEventStreamMessage> domainEventPublisher,
            IOHelper ioHelper,
            ILoggerFactory loggerFactory)
        {
            _eventCommittingContextMailBoxList = new List <EventCommittingContextMailBox>();
            _ioHelper             = ioHelper;
            _jsonSerializer       = jsonSerializer;
            _scheduleService      = scheduleService;
            _typeNameProvider     = typeNameProvider;
            _memoryCache          = memoryCache;
            _aggregateRootFactory = aggregateRootFactory;
            _aggregateStorage     = aggregateStorage;
            _eventStore           = eventStore;
            _domainEventPublisher = domainEventPublisher;
            _logger            = loggerFactory.Create(GetType().FullName);
            _eventMailboxCount = ENodeConfiguration.Instance.Setting.EventMailBoxCount;
            _batchSize         = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;

            for (var i = 0; i < _eventMailboxCount; i++)
            {
                _eventCommittingContextMailBoxList.Add(new EventCommittingContextMailBox(i, _batchSize, x => BatchPersistEventAsync(x, 0), _logger));
            }
        }
コード例 #6
0
 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="waitingCommandService"></param>
 /// <param name="aggregateRootTypeCodeProvider"></param>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="eventStreamConvertService"></param>
 /// <param name="eventSourcingService"></param>
 /// <param name="memoryCache"></param>
 /// <param name="aggregateStorage"></param>
 /// <param name="retryCommandService"></param>
 /// <param name="eventStore"></param>
 /// <param name="eventPublisher"></param>
 /// <param name="actionExecutionService"></param>
 /// <param name="eventSynchronizerProvider"></param>
 /// <param name="loggerFactory"></param>
 public DefaultCommitEventService(
     IWaitingCommandService waitingCommandService,
     IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider,
     IAggregateRootFactory aggregateRootFactory,
     IEventStreamConvertService eventStreamConvertService,
     IEventSourcingService eventSourcingService,
     IMemoryCache memoryCache,
     IAggregateStorage aggregateStorage,
     IRetryCommandService retryCommandService,
     IEventStore eventStore,
     IEventPublisher eventPublisher,
     IActionExecutionService actionExecutionService,
     IEventSynchronizerProvider eventSynchronizerProvider,
     ILoggerFactory loggerFactory)
 {
     _waitingCommandService = waitingCommandService;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _aggregateRootFactory = aggregateRootFactory;
     _eventStreamConvertService = eventStreamConvertService;
     _eventSourcingService = eventSourcingService;
     _memoryCache = memoryCache;
     _aggregateStorage = aggregateStorage;
     _retryCommandService = retryCommandService;
     _eventStore = eventStore;
     _eventPublisher = eventPublisher;
     _actionExecutionService = actionExecutionService;
     _eventSynchronizerProvider = eventSynchronizerProvider;
     _logger = loggerFactory.Create(GetType().Name);
 }
コード例 #7
0
 public DefaultMemoryCache(ITypeNameProvider typeNameProvider, IAggregateStorage aggregateStorage, ILoggerFactory loggerFactory)
 {
     _aggregateRootInfoDict = new ConcurrentDictionary <string, AggregateCacheInfo>();
     _typeNameProvider      = typeNameProvider;
     _aggregateStorage      = aggregateStorage;
     _logger = loggerFactory.Create(GetType().FullName);
 }
コード例 #8
0
 public DefaultEventService(
     IJsonSerializer jsonSerializer,
     IScheduleService scheduleService,
     ITypeNameProvider typeNameProvider,
     IMemoryCache memoryCache,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateStorage aggregateStorage,
     IEventStore eventStore,
     IMessagePublisher <DomainEventStreamMessage> domainEventPublisher,
     IOHelper ioHelper,
     ILoggerFactory loggerFactory)
 {
     _mailboxDict          = new ConcurrentDictionary <string, EventMailBox>();
     _ioHelper             = ioHelper;
     _jsonSerializer       = jsonSerializer;
     _scheduleService      = scheduleService;
     _typeNameProvider     = typeNameProvider;
     _memoryCache          = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateStorage     = aggregateStorage;
     _eventStore           = eventStore;
     _domainEventPublisher = domainEventPublisher;
     _logger         = loggerFactory.Create(GetType().FullName);
     _batchSize      = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;
     _timeoutSeconds = ENodeConfiguration.Instance.Setting.AggregateRootMaxInactiveSeconds;
     _taskName       = "CleanInactiveAggregates_" + DateTime.Now.Ticks + new Random().Next(10000);
 }
コード例 #9
0
 public CreateJusticeCaseUseCase(
     IAggregateStorage <JusticeCase> justiceCaseStorage,
     ILogger <CreateJusticeCaseUseCase> logger)
 {
     _justiceCaseStorage = justiceCaseStorage;
     _logger             = logger;
 }
コード例 #10
0
 public DefaultMemoryCache(ITypeCodeProvider aggregateRootTypeCodeProvider, IAggregateStorage aggregateStorage, IScheduleService scheduleService, ILoggerFactory loggerFactory)
 {
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _aggregateStorage = aggregateStorage;
     _scheduleService  = scheduleService;
     _logger           = loggerFactory.Create(GetType().FullName);
     TimeoutSeconds    = ENodeConfiguration.Instance.Setting.AggregateRootMaxInactiveSeconds;
     _scheduleService.StartTask("RemoveExpiredAggregates", RemoveExpiredAggregates, 1000, ENodeConfiguration.Instance.Setting.ScanExpiredAggregateIntervalMilliseconds);
 }
コード例 #11
0
 public CommandExecuteContext(IRepository repository, IAggregateStorage aggregateRootStorage, CommandMessage commandMessage, SendReplyService sendReplyService, IMessageTransportationContext messageContext, ILogger logger)
 {
     _trackingAggregateRootDict = new ConcurrentDictionary <string, IAggregateRoot>();
     _repository           = repository;
     _aggregateRootStorage = aggregateRootStorage;
     _sendReplyService     = sendReplyService;
     _messageContext       = messageContext;
     _commandMessage       = commandMessage;
     _logger = logger;
 }
コード例 #12
0
ファイル: DefaultMemoryCache.cs プロジェクト: softchar/enode
 public DefaultMemoryCache(IScheduleService scheduleService, ITypeNameProvider typeNameProvider, IAggregateStorage aggregateStorage, ILoggerFactory loggerFactory)
 {
     _scheduleService       = scheduleService;
     _aggregateRootInfoDict = new ConcurrentDictionary <string, AggregateCacheInfo>();
     _typeNameProvider      = typeNameProvider;
     _aggregateStorage      = aggregateStorage;
     _logger         = loggerFactory.Create(GetType().FullName);
     _timeoutSeconds = ENodeConfiguration.Instance.Setting.AggregateRootMaxInactiveSeconds;
     _taskName       = "CleanInactiveAggregates_" + DateTime.Now.Ticks + new Random().Next(10000);
 }
コード例 #13
0
 public CommandExecuteContext(IRepository repository, IAggregateStorage aggregateRootStorage, QueueMessage queueMessage, IMessageContext messageContext, CommandMessage commandMessage, SendReplyService sendReplyService)
 {
     _trackingAggregateRootDict = new ConcurrentDictionary <string, IAggregateRoot>();
     _repository           = repository;
     _aggregateRootStorage = aggregateRootStorage;
     _sendReplyService     = sendReplyService;
     _queueMessage         = queueMessage;
     _commandMessage       = commandMessage;
     _messageContext       = messageContext;
 }
コード例 #14
0
 public CommandConsumer(string groupName = null, ConsumerSetting setting = null)
 {
     _consumer             = new Consumer(groupName ?? DefaultCommandConsumerGroup, setting);
     _sendReplyService     = new SendReplyService();
     _jsonSerializer       = ObjectContainer.Resolve <IJsonSerializer>();
     _typeNameProvider     = ObjectContainer.Resolve <ITypeNameProvider>();
     _processor            = ObjectContainer.Resolve <IMessageProcessor <ProcessingCommand, ICommand, CommandResult> >();
     _repository           = ObjectContainer.Resolve <IRepository>();
     _aggregateRootStorage = ObjectContainer.Resolve <IAggregateStorage>();
     _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
 }
コード例 #15
0
ファイル: CommandConsumer.cs プロジェクト: pangfd/enode
 public CommandConsumer InitializeENode()
 {
     _sendReplyService = new SendReplyService("CommandConsumerSendReplyService");
     _jsonSerializer   = ObjectContainer.Resolve <IJsonSerializer>();
     _typeNameProvider = ObjectContainer.Resolve <ITypeNameProvider>();
     _commandProcessor = ObjectContainer.Resolve <ICommandProcessor>();
     _repository       = ObjectContainer.Resolve <IRepository>();
     _aggregateStorage = ObjectContainer.Resolve <IAggregateStorage>();
     _logger           = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
     return(this);
 }
コード例 #16
0
ファイル: Repository.cs プロジェクト: imyounghan/umizoo
 public Repository(IMessageBus <IEvent> eventBus,
                   IAggregateStorage storage,
                   IEventStore eventStore,
                   ISnapshotStore snapshotStore,
                   ICacheProvider cacheProvider)
 {
     _eventBus      = eventBus;
     _storage       = storage;
     _eventStore    = eventStore;
     _snapshotStore = snapshotStore;
     _cacheProvider = cacheProvider;
 }
コード例 #17
0
ファイル: CommandConsumer.cs プロジェクト: kfhuangy/enode
 public CommandConsumer Initialize(string groupName = null, ConsumerSetting setting = null)
 {
     _consumer = new Consumer(groupName ?? DefaultCommandConsumerGroup, setting ?? new ConsumerSetting
     {
         ConsumeFromWhere = ConsumeFromWhere.FirstOffset
     });
     _sendReplyService     = new SendReplyService();
     _jsonSerializer       = ObjectContainer.Resolve <IJsonSerializer>();
     _typeNameProvider     = ObjectContainer.Resolve <ITypeNameProvider>();
     _processor            = ObjectContainer.Resolve <ICommandProcessor>();
     _repository           = ObjectContainer.Resolve <IRepository>();
     _aggregateRootStorage = ObjectContainer.Resolve <IAggregateStorage>();
     _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
     return(this);
 }
コード例 #18
0
        public DefaultEventService(
            IJsonSerializer jsonSerializer,
            IScheduleService scheduleService,
            ITypeNameProvider typeNameProvider,
            IMemoryCache memoryCache,
            IAggregateRootFactory aggregateRootFactory,
            IAggregateStorage aggregateStorage,
            IEventStore eventStore,
            IMessagePublisher <DomainEventStreamMessage> domainEventPublisher,
            IOHelper ioHelper,
            ILoggerFactory loggerFactory)
        {
            var setting = ENodeConfiguration.Instance.Setting;

            _enableGroupCommit   = setting.EnableGroupCommitEvent;
            _groupCommitInterval = setting.GroupCommitEventIntervalMilliseconds;
            _groupCommitMaxSize  = setting.GroupCommitMaxSize;
            _ioHelper            = ioHelper;
            Ensure.Positive(_groupCommitInterval, "_groupCommitInterval");
            Ensure.Positive(_groupCommitMaxSize, "_groupCommitMaxSize");

            _toCommitContextQueue         = new ConcurrentQueue <EventCommittingContext>();
            _successPersistedContextQueue = new BlockingCollection <IEnumerable <EventCommittingContext> >();
            _failedPersistedContextQueue  = new BlockingCollection <IEnumerable <EventCommittingContext> >();

            _jsonSerializer       = jsonSerializer;
            _scheduleService      = scheduleService;
            _typeNameProvider     = typeNameProvider;
            _memoryCache          = memoryCache;
            _aggregateRootFactory = aggregateRootFactory;
            _aggregateStorage     = aggregateStorage;
            _eventStore           = eventStore;
            _domainEventPublisher = domainEventPublisher;
            _logger = loggerFactory.Create(GetType().FullName);
            _processSuccessPersistedEventsWorker = new Worker("ProcessSuccessPersistedEvents", ProcessSuccessPersistedEvents);
            _processFailedPersistedEventsWorker  = new Worker("ProcessFailedPersistedEvents", ProcessFailedPersistedEvents);

            Start();
        }
コード例 #19
0
        public DefaultEventService(
            IJsonSerializer jsonSerializer,
            IScheduleService scheduleService,
            ITypeNameProvider typeNameProvider,
            IMemoryCache memoryCache,
            IAggregateRootFactory aggregateRootFactory,
            IAggregateStorage aggregateStorage,
            IEventStore eventStore,
            IMessagePublisher<DomainEventStreamMessage> domainEventPublisher,
            IOHelper ioHelper,
            ILoggerFactory loggerFactory)
        {
            var setting = ENodeConfiguration.Instance.Setting;
            _enableGroupCommit = setting.EnableGroupCommitEvent;
            _groupCommitInterval = setting.GroupCommitEventIntervalMilliseconds;
            _groupCommitMaxSize = setting.GroupCommitMaxSize;
            _ioHelper = ioHelper;
            Ensure.Positive(_groupCommitInterval, "_groupCommitInterval");
            Ensure.Positive(_groupCommitMaxSize, "_groupCommitMaxSize");

            _toCommitContextQueue = new ConcurrentQueue<EventCommittingContext>();
            _successPersistedContextQueue = new BlockingCollection<IEnumerable<EventCommittingContext>>();
            _failedPersistedContextQueue = new BlockingCollection<IEnumerable<EventCommittingContext>>();

            _jsonSerializer = jsonSerializer;
            _scheduleService = scheduleService;
            _typeNameProvider = typeNameProvider;
            _memoryCache = memoryCache;
            _aggregateRootFactory = aggregateRootFactory;
            _aggregateStorage = aggregateStorage;
            _eventStore = eventStore;
            _domainEventPublisher = domainEventPublisher;
            _logger = loggerFactory.Create(GetType().FullName);
            _processSuccessPersistedEventsWorker = new Worker("ProcessSuccessPersistedEvents", ProcessSuccessPersistedEvents);
            _processFailedPersistedEventsWorker = new Worker("ProcessFailedPersistedEvents", ProcessFailedPersistedEvents);

            Start();
        }
コード例 #20
0
 public DefaultEventService(
     IJsonSerializer jsonSerializer,
     IScheduleService scheduleService,
     ITypeNameProvider typeNameProvider,
     IMemoryCache memoryCache,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateStorage aggregateStorage,
     IEventStore eventStore,
     IMessagePublisher<DomainEventStreamMessage> domainEventPublisher,
     IOHelper ioHelper,
     ILoggerFactory loggerFactory)
 {
     _ioHelper = ioHelper;
     _jsonSerializer = jsonSerializer;
     _scheduleService = scheduleService;
     _typeNameProvider = typeNameProvider;
     _memoryCache = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateStorage = aggregateStorage;
     _eventStore = eventStore;
     _domainEventPublisher = domainEventPublisher;
     _logger = loggerFactory.Create(GetType().FullName);
 }
コード例 #21
0
 public DefaultEventService(
     IJsonSerializer jsonSerializer,
     IScheduleService scheduleService,
     ITypeNameProvider typeNameProvider,
     IMemoryCache memoryCache,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateStorage aggregateStorage,
     IEventStore eventStore,
     IMessagePublisher <DomainEventStreamMessage> domainEventPublisher,
     IOHelper ioHelper,
     ILoggerFactory loggerFactory)
 {
     _ioHelper             = ioHelper;
     _jsonSerializer       = jsonSerializer;
     _scheduleService      = scheduleService;
     _typeNameProvider     = typeNameProvider;
     _memoryCache          = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateStorage     = aggregateStorage;
     _eventStore           = eventStore;
     _domainEventPublisher = domainEventPublisher;
     _logger = loggerFactory.Create(GetType().FullName);
 }
コード例 #22
0
 public EventSourcingRepository(IMemoryCache memoryCache, IAggregateStorage aggregateRootStorage)
 {
     _memoryCache          = memoryCache;
     _aggregateRootStorage = aggregateRootStorage;
 }
コード例 #23
0
 public AlertsStorage(IAggregateStorage aggregateStorage)
 {
     _aggregateStorage = aggregateStorage;
 }
コード例 #24
0
 public HistoryAggregator(IHistoryStorage historyStorage, IAggregateStorage aggregateStorage)
 {
     _historyStorage   = historyStorage;
     _aggregateStorage = aggregateStorage;
 }
コード例 #25
0
 public EventsController(IAggregateStorage storage, Migration migration)
 {
     _storage   = storage;
     _migration = migration;
 }
コード例 #26
0
 public PortfolioStorage(IAggregateStorage aggregateStorage)
 {
     _aggregateStorage = aggregateStorage;
 }
コード例 #27
0
ファイル: Session.cs プロジェクト: bohulenkov14/erden
 /// <summary>
 /// Initialize a new instance of <see cref="Session"/> class
 /// </summary>
 /// <param name="storage">Persistent aggregate storage</param>
 public Session(IAggregateStorage storage)
 {
     this.storage = storage;
 }
コード例 #28
0
 public DefaultMemoryCache(ITypeCodeProvider aggregateRootTypeCodeProvider, IAggregateStorage aggregateStorage, ILoggerFactory loggerFactory)
 {
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _aggregateStorage = aggregateStorage;
     _logger           = loggerFactory.Create(GetType().FullName);
 }
コード例 #29
0
 public EventsController(IAggregateStorage storage)
 {
     _storage = storage;
 }
コード例 #30
0
ファイル: DefaultRepository.cs プロジェクト: hardweight/enode
 public DefaultRepository(IMemoryCache memoryCache, IAggregateStorage aggregateRootStorage)
 {
     _memoryCache          = memoryCache;
     _aggregateRootStorage = aggregateRootStorage;
 }
コード例 #31
0
 public HealthCheck(IAggregateStorage storage)
 {
     _storage = storage;
 }