示例#1
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));
            }
        }
示例#2
0
 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;
 }
 /// <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);
 }
示例#4
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);
 }
示例#5
0
 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="processingCommandCache"></param>
 /// <param name="commandAsyncResultManager"></param>
 /// <param name="aggregateRootTypeProvider"></param>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="memoryCache"></param>
 /// <param name="repository"></param>
 /// <param name="retryCommandService"></param>
 /// <param name="eventStore"></param>
 /// <param name="eventPublisher"></param>
 /// <param name="retryService"></param>
 /// <param name="eventSynchronizerProvider"></param>
 /// <param name="loggerFactory"></param>
 public DefaultUncommittedEventExecutor(
     IProcessingCommandCache processingCommandCache,
     ICommandAsyncResultManager commandAsyncResultManager,
     IAggregateRootTypeProvider aggregateRootTypeProvider,
     IAggregateRootFactory aggregateRootFactory,
     IMemoryCache memoryCache,
     IRepository repository,
     IRetryCommandService retryCommandService,
     IEventStore eventStore,
     IEventPublisher eventPublisher,
     IRetryService retryService,
     IEventSynchronizerProvider eventSynchronizerProvider,
     ILoggerFactory loggerFactory)
 {
     _processingCommandCache    = processingCommandCache;
     _commandAsyncResultManager = commandAsyncResultManager;
     _aggregateRootTypeProvider = aggregateRootTypeProvider;
     _aggregateRootFactory      = aggregateRootFactory;
     _memoryCache               = memoryCache;
     _repository                = repository;
     _retryCommandService       = retryCommandService;
     _eventStore                = eventStore;
     _eventPublisher            = eventPublisher;
     _retryService              = retryService;
     _eventSynchronizerProvider = eventSynchronizerProvider;
     _logger = loggerFactory.Create(GetType().Name);
 }
示例#6
0
 public EventRepository(IAggregateRootFactory factory, IEventBus eventBus, IEventStore eventStore, ISnapshotService snapshotService)
 {
     _factory         = factory;
     _eventBus        = eventBus;
     _eventStore      = eventStore;
     _snapshotService = snapshotService;
 }
示例#7
0
 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="memoryCache"></param>
 /// <param name="eventStore"></param>
 /// <param name="snapshotStore"></param>
 public EventSourcingRepository(IAggregateRootFactory aggregateRootFactory, IMemoryCache memoryCache, IEventStore eventStore, ISnapshotStore snapshotStore)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _memoryCache          = memoryCache;
     _eventStore           = eventStore;
     _snapshotStore        = snapshotStore;
 }
        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));
            }
        }
示例#9
0
 public EventReposiotryUnitTests()
 {
     _aggregateRootFactory = Substitute.For <IAggregateRootFactory>();
     _eventBus             = Substitute.For <IEventBus>();
     _eventStore           = Substitute.For <IEventStore>();
     _snapshotService      = Substitute.For <ISnapshotService>();
     _eventRepository      = new EventRepository(_aggregateRootFactory, _eventBus, _eventStore, _snapshotService);
 }
示例#10
0
 public RavenDbEventSourcingAggregateTransactionFactory(
     IRavenDbSessionFactory sessionFactory,
     IAggregateRootFactory aggregateRootFactory
     )
 {
     _sessionFactory       = sessionFactory;
     _aggregateRootFactory = aggregateRootFactory;
 }
示例#11
0
 public AggregateRepository(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore <TId> eventStore,
     IBus bus)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore           = eventStore;
     _bus = bus;
 }
 /// <summary>
 /// Creates new instance.
 /// </summary>
 /// <param name="eventStore">The underlaying event store.</param>
 /// <param name="commandStore">The underlaying command store.</param>
 /// <param name="eventFormatter">The formatter for serializing event payloads.</param>
 /// <param name="commandFormatter">The formatter for serializing commands.</param>
 /// <param name="factory">The process root factory.</param>
 /// <param name="eventDispatcher">The dispatcher for newly created events in the processes.</param>
 /// <param name="commandDispatcher">The dispatcher for newly created commands in the processes.</param>
 /// <param name="snapshotProvider">The snapshot provider.</param>
 /// <param name="snapshotStore">The store for snapshots.</param>
 public ProcessRootRepository(IEventStore eventStore, ICommandStore commandStore, IFormatter eventFormatter, ISerializer commandFormatter,
                              IAggregateRootFactory <T> factory, IEventDispatcher eventDispatcher, ICommandDispatcher commandDispatcher, ISnapshotProvider snapshotProvider, ISnapshotStore snapshotStore)
     : base(eventStore, eventFormatter, factory, eventDispatcher, snapshotProvider, snapshotStore)
 {
     Ensure.NotNull(commandStore, "commandStore");
     Ensure.NotNull(commandDispatcher, "commandDispatcher");
     Ensure.NotNull(commandFormatter, "commandFormatter");
     this.commandStore      = commandStore;
     this.commandFormatter  = commandFormatter;
     this.commandDispatcher = commandDispatcher;
 }
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     IAggregateSnapshotter aggregateSnapshotter,
     ITypeNameProvider typeNameProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore = eventStore;
     _aggregateSnapshotter = aggregateSnapshotter;
     _typeNameProvider = typeNameProvider;
 }
示例#14
0
 public DefaultMemoryCacheRebuilder(
     IAggregateRootFactory aggregateRootFactory,
     IAggregateRootTypeProvider aggregateRootTypeProvider,
     IEventStore eventStore,
     IMemoryCache memoryCache)
 {
     _aggregateRootFactory      = aggregateRootFactory;
     _aggregateRootTypeProvider = aggregateRootTypeProvider;
     _eventStore  = eventStore;
     _memoryCache = memoryCache;
 }
示例#15
0
 public DefaultMemoryCacheRebuilder(
     IAggregateRootFactory aggregateRootFactory,
     IAggregateRootTypeProvider aggregateRootTypeProvider,
     IEventStore eventStore,
     IMemoryCache memoryCache)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateRootTypeProvider = aggregateRootTypeProvider;
     _eventStore = eventStore;
     _memoryCache = memoryCache;
 }
 public DefaultMemoryCacheRefreshService(
     IMemoryCache memoryCache,
     IRepository repository,
     IAggregateRootFactory aggregateRootFactory,
     IAggregateRootTypeProvider aggregateRootTypeProvider)
 {
     _memoryCache = memoryCache;
     _repository = repository;
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateRootTypeProvider = aggregateRootTypeProvider;
 }
 public GenericRepository(
     IEventStoreProvider eventStoreProvider,
     ISnapshotStoreProvider snapshotStoreProvider,
     IAggregateRootFactory aggregateRootFactory,
     IUnitOfWorkManager unitOfWorkManager)
 {
     _eventStoreProvider    = eventStoreProvider;
     _snapshotStoreProvider = snapshotStoreProvider;
     _aggregateRootFactory  = aggregateRootFactory;
     _unitOfWorkManager     = unitOfWorkManager;
 }
示例#18
0
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     IAggregateSnapshotter aggregateSnapshotter,
     ITypeNameProvider typeNameProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore           = eventStore;
     _aggregateSnapshotter = aggregateSnapshotter;
     _typeNameProvider     = typeNameProvider;
 }
示例#19
0
        public RavenDbEventSourcingAggregateTransaction(
            IAsyncDocumentSession session,
            string aggregateId,
            IAggregateRootFactory aggregateRootFactory
            )
            : base(aggregateId, aggregateRootFactory)
        {
            session.Advanced.UseOptimisticConcurrency = false;
            _session = session;

            _chexKey = $"{AggregateHelper<TAggregate>.Name}/{aggregateId}/version";
        }
示例#20
0
 public ContextBase()
 {
     _trackingAggregateRoots        = new List <AggregateRoot>();
     _syncEventPublisher            = ObjectContainer.Resolve <ISyncEventPublisher>();
     _asyncEventPublisher           = ObjectContainer.Resolve <IAsyncEventPublisher>();
     _aggregateRootFactory          = ObjectContainer.Resolve <IAggregateRootFactory>();
     _aggregateEventHandlerProvider = ObjectContainer.Resolve <IAggregateEventHandlerProvider>();
     _eventStore         = ObjectContainer.Resolve <IEventStore>();
     _snapshotStore      = ObjectContainer.Resolve <ISnapshotStore>();
     _transactionManager = ObjectContainer.Resolve <IContextTransactionManager>();
     _logger             = ObjectContainer.Resolve <ILoggerFactory>().Create(string.Format("EventSourcing.{0}", GetType().Name));
 }
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotter snapshotter,
     ITypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory          = aggregateRootFactory;
     _eventStore                    = eventStore;
     _snapshotStore                 = snapshotStore;
     _snapshotter                   = snapshotter;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotter snapshotter,
     ITypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore = eventStore;
     _snapshotStore = snapshotStore;
     _snapshotter = snapshotter;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
示例#23
0
 /// <summary>
 /// Aggregate snapshot saver
 /// </summary>
 /// <param name="typeNameProvider"></param>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="eventStore"></param>
 /// <param name="snapshotStore"></param>
 public DefaultAggregateSnapshotSaver(
     ITypeNameProvider typeNameProvider,
     IAggregateRootFactory aggregateRootFactory,
     IEventStore eventStore,
     IAggregateSnapshotStore snapshotStore)
 {
     _typeNameProvider     = typeNameProvider;
     _aggregateRootFactory = aggregateRootFactory;
     _eventStore           = eventStore;
     _snapshotStore        = snapshotStore;
     _binaryFormatter      = new BinaryFormatter();
     _batchSaveSize        = 100;
     _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
 }
 /// <summary>Parameterized constructor.
 /// </summary>
 /// <param name="aggregateRootFactory"></param>
 /// <param name="eventStreamConvertService"></param>
 /// <param name="eventSourcingService"></param>
 /// <param name="eventStore"></param>
 /// <param name="snapshotStore"></param>
 /// <param name="aggregateRootTypeCodeProvider"></param>
 public EventSourcingAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     IEventStreamConvertService eventStreamConvertService,
     IEventSourcingService eventSourcingService,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _eventStreamConvertService = eventStreamConvertService;
     _eventSourcingService = eventSourcingService;
     _eventStore = eventStore;
     _snapshotStore = snapshotStore;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
示例#25
0
 public CompatibleAggregateStorage(
     IAggregateRootFactory aggregateRootFactory,
     ISingleHandlerProvider <ICompatibleStoreHandler> compatibleStoreHandlerProvider,
     IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotter snapshotter,
     ITypeCodeProvider aggregateRootTypeCodeProvider)
 {
     _aggregateRootFactory           = aggregateRootFactory;
     _compatibleStoreHandlerProvider = compatibleStoreHandlerProvider;
     _eventStore    = eventStore;
     _snapshotStore = snapshotStore;
     _snapshotter   = snapshotter;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
 }
示例#26
0
 /// <summary>
 /// Creates new instance.
 /// </summary>
 /// <param name="store">The underlaying event store.</param>
 /// <param name="formatter">The formatter for serializing and deserializing event payloads.</param>
 /// <param name="factory">The aggregate root factory.</param>
 /// <param name="eventDispatcher">The dispatcher for newly created events in the aggregates.</param>
 /// <param name="snapshotProvider">The snapshot provider.</param>
 /// <param name="snapshotStore">The store for snapshots.</param>
 public AggregateRootRepository(IEventStore store, IFormatter formatter, IAggregateRootFactory <T> factory, IEventDispatcher eventDispatcher,
                                ISnapshotProvider snapshotProvider, ISnapshotStore snapshotStore)
 {
     Ensure.NotNull(store, "store");
     Ensure.NotNull(formatter, "formatter");
     Ensure.NotNull(factory, "factory");
     Ensure.NotNull(eventDispatcher, "eventDispatcher");
     Ensure.NotNull(snapshotProvider, "snapshotProvider");
     Ensure.NotNull(snapshotStore, "snapshotStore");
     this.store            = store;
     this.formatter        = formatter;
     this.factory          = factory;
     this.eventDispatcher  = eventDispatcher;
     this.snapshotProvider = snapshotProvider;
     this.snapshotStore    = snapshotStore;
 }
 public DefaultAggregateRootStateBackend(
     ITimer timer,
     IAggregateRootMemoryCache memoryCache,
     IDomainEventStateBackend stateBackend,
     IOptions <CheckpointTriggerOptions> options,
     IAggregateRootFactory aggregateRootFactory,
     ILogger <DefaultAggregateRootStateBackend> logger,
     IAggregateRootCheckpointManager checkpointManager)
 {
     _timer                = timer;
     _logger               = logger;
     _eventStateBackend    = stateBackend;
     _checkpointManager    = checkpointManager;
     _memoryCache          = memoryCache;
     _aggregateRootFactory = aggregateRootFactory;
     _options              = options.Value;
 }
示例#28
0
 /// <summary>
 /// Parameterized constructor.
 /// </summary>
 public EventSourcedRepository(IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotPolicy snapshotPolicy,
     IMemoryCache cache,
     IEventBus eventBus,
     IAggregateRootFactory aggregateFactory,
     IBinarySerializer binarySerializer)
 {
     this._eventStore = eventStore;
     this._snapshotStore = snapshotStore;
     this._snapshotPolicy = snapshotPolicy;
     this._cache = cache;
     this._eventBus = eventBus;
     this._aggregateFactory = aggregateFactory;
     this._binarySerializer = binarySerializer;
     //this._textSerializer = textSerializer;
     this._logger = LogManager.GetLogger("ThinkNet");
 }
示例#29
0
        protected override void SetUp()
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule <EventSourcingCoreModule>();
            containerBuilder.RegisterEventStorePersistenceModule(_testFixtureOptions["EventStorePersistence"]);
            containerBuilder.RegisterModule <TestSetupModule>();

            containerBuilder.RegisterType <Calculator>().As <ICalculator>();
            containerBuilder.RegisterType <AccountAggregateRoot>();
            containerBuilder.RegisterType <NonDisposingAccountAggregateRoot>();

            var container = containerBuilder.Build();

            Subject = container.Resolve <IAggregateRepository <AccountAggregateRoot, Guid> >();
            AggregateRootFactory = container.Resolve <IAggregateRootFactory>();
            AggregateId          = CreateAggregateId();
        }
示例#30
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();
        }
示例#31
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();
        }
示例#32
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);
 }
示例#33
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);
 }
示例#34
0
 public DomainRepository(IAggregateRootFactory aggregateRootFactory)
 {
     _aggregateRootFactory = aggregateRootFactory;
 }
示例#35
0
 public DefaultSnapshotter(IAggregateRootFactory aggregateRootFactory, IAggregateRootTypeProvider aggregateRootTypeProvider)
 {
     _aggregateRootFactory      = aggregateRootFactory;
     _aggregateRootTypeProvider = aggregateRootTypeProvider;
 }
示例#36
0
 public TestRepository(IAggregateRootFactory <ITestAggregateRoot, TestAggregateRootId> factory, IEventStore eventStore)
     : base(factory, eventStore)
 {
 }
示例#37
0
        public Repository(IAggregateRootFactory <TAggregateRoot, TAggregateRootId> factory, IEventStore eventStore)
        {
            Factory = factory;

            EventStore = eventStore;
        }
示例#38
0
 public AggregateTransaction(string identifier, IAggregateRootFactory aggregateRootFactory)
 {
     Identifier = identifier;
     Aggregate  = aggregateRootFactory.Create <TAggregateRoot>();
 }
示例#39
0
 public DefaultSnapshotter(IAggregateRootFactory aggregateRootFactory, ITypeCodeProvider aggregateRootTypeCodeProvider, IBinarySerializer binarySerializer)
 {
     _aggregateRootFactory          = aggregateRootFactory;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _binarySerializer = binarySerializer;
 }
示例#40
0
 public DefaultSnapshotter(IAggregateRootFactory aggregateRootFactory, ITypeCodeProvider aggregateRootTypeCodeProvider, IBinarySerializer binarySerializer)
 {
     _aggregateRootFactory = aggregateRootFactory;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _binarySerializer = binarySerializer;
 }
示例#41
0
 public DefaultSnapshotter(IAggregateRootFactory aggregateRootFactory)
 {
     _aggregateRootFactory = aggregateRootFactory;
 }