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>Default constructor. /// </summary> public SqlServerCommandStore(OptionSetting optionSetting) { if (optionSetting != null) { _connectionString = optionSetting.GetOptionValue<string>("ConnectionString"); _tableName = optionSetting.GetOptionValue<string>("TableName"); _uniqueIndexName = optionSetting.GetOptionValue<string>("UniqueIndexName"); } else { var setting = ENodeConfiguration.Instance.Setting.DefaultDBConfigurationSetting; _connectionString = setting.ConnectionString; _tableName = setting.CommandTableName; _uniqueIndexName = setting.CommandTableCommandIdUniqueIndexName; } Ensure.NotNull(_connectionString, "_connectionString"); Ensure.NotNull(_tableName, "_tableName"); Ensure.NotNull(_uniqueIndexName, "_uniqueIndexName"); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _typeNameProvider = ObjectContainer.Resolve<ITypeNameProvider>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
public SendReplyService() { _clientWrapperDict = new ConcurrentDictionary<string, SocketRemotingClientWrapper>(); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _scheduleService = ObjectContainer.Resolve<IScheduleService>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
public SendReplyService() { _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _scheduleService = ObjectContainer.Resolve<IScheduleService>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); _sendReplyRemotingClientDict = new ConcurrentDictionary<string, SocketRemotingClientWrapper>(); _taskFactory = new TaskFactory(new LimitedConcurrencyLevelTaskScheduler(Environment.ProcessorCount)); }
public CommandService(CommandResultProcessor commandResultProcessor = null, string id = null, ProducerSetting setting = null) { _commandResultProcessor = commandResultProcessor; _producer = new Producer(id ?? DefaultCommandServiceProcuderId, setting ?? new ProducerSetting()); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _commandTopicProvider = ObjectContainer.Resolve<ITopicProvider<ICommand>>(); _commandTypeCodeProvider = ObjectContainer.Resolve<ITypeCodeProvider>(); _commandRouteKeyProvider = ObjectContainer.Resolve<ICommandRoutingKeyProvider>(); _sendMessageService = new SendQueueMessageService(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); _ioHelper = ObjectContainer.Resolve<IOHelper>(); }
public DefaultMessageDispatcher( ITypeCodeProvider typeCodeProvider, IMessageHandlerProvider handlerProvider, IMessageHandleRecordStore messageHandleRecordStore, IOHelper ioHelper, ILoggerFactory loggerFactory) { _typeCodeProvider = typeCodeProvider; _handlerProvider = handlerProvider; _messageHandleRecordStore = messageHandleRecordStore; _ioHelper = ioHelper; _logger = loggerFactory.Create(GetType().FullName); }
/// <summary>Parameterized constructor. /// </summary> public SqlServerCommandStore() { var setting = ENodeConfiguration.Instance.Setting.SqlServerCommandStoreSetting; Ensure.NotNull(setting, "SqlServerCommandStoreSetting"); Ensure.NotNull(setting.ConnectionString, "ConnectionString"); Ensure.NotNull(setting.GetOptionValue<string>("TableName"), "TableName"); Ensure.NotNull(setting.GetOptionValue<string>("PrimaryKeyName"), "PrimaryKeyName"); _connectionString = setting.ConnectionString; _commandTable = setting.GetOptionValue<string>("TableName"); _primaryKeyName = setting.GetOptionValue<string>("PrimaryKeyName"); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _typeCodeProvider = ObjectContainer.Resolve<ITypeCodeProvider>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
/// <summary>Default constructor. /// </summary> public SqlServerCommandStore(OptionSetting optionSetting) { Ensure.NotNull(optionSetting, "optionSetting"); _connectionString = optionSetting.GetOptionValue<string>("ConnectionString"); _tableName = optionSetting.GetOptionValue<string>("TableName"); _primaryKeyName = optionSetting.GetOptionValue<string>("PrimaryKeyName"); Ensure.NotNull(_connectionString, "_connectionString"); Ensure.NotNull(_tableName, "_tableName"); Ensure.NotNull(_primaryKeyName, "_primaryKeyName"); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _typeNameProvider = ObjectContainer.Resolve<ITypeNameProvider>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
public SqlServerEventStore() { var configSetting = ENodeConfiguration.Instance.Setting; var setting = configSetting.SqlServerEventStoreSetting; Ensure.NotNull(setting, "SqlServerEventStoreSetting"); Ensure.NotNull(setting.ConnectionString, "SqlServerEventStoreSetting.ConnectionString"); Ensure.NotNull(setting.TableName, "SqlServerEventStoreSetting.TableName"); Ensure.NotNull(setting.PrimaryKeyName, "SqlServerEventStoreSetting.PrimaryKeyName"); Ensure.Positive(configSetting.SqlServerBulkCopyBatchSize, "SqlServerBulkCopyBatchSize"); Ensure.Positive(configSetting.SqlServerBulkCopyTimeout, "SqlServerBulkCopyTimeout"); _connectionString = setting.ConnectionString; _eventTable = setting.TableName; _primaryKeyName = setting.PrimaryKeyName; _bulkCopyBatchSize = configSetting.SqlServerBulkCopyBatchSize; _bulkCopyTimeout = configSetting.SqlServerBulkCopyTimeout; _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _eventSerializer = ObjectContainer.Resolve<IEventSerializer>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
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(); }
public SqlServerEventStore(OptionSetting optionSetting) { if (optionSetting != null) { _connectionString = optionSetting.GetOptionValue<string>("ConnectionString"); _tableName = optionSetting.GetOptionValue<string>("TableName"); _tableCount = optionSetting.GetOptionValue<int>("TableCount"); _versionIndexName = optionSetting.GetOptionValue<string>("VersionIndexName"); _commandIndexName = optionSetting.GetOptionValue<string>("CommandIndexName"); _bulkCopyBatchSize = optionSetting.GetOptionValue<int>("BulkCopyBatchSize"); _bulkCopyTimeout = optionSetting.GetOptionValue<int>("BulkCopyTimeout"); } else { var setting = ENodeConfiguration.Instance.Setting.DefaultDBConfigurationSetting; _connectionString = setting.ConnectionString; _tableName = setting.EventTableName; _tableCount = setting.EventTableCount; _versionIndexName = setting.EventTableVersionUniqueIndexName; _commandIndexName = setting.EventTableCommandIdUniqueIndexName; _bulkCopyBatchSize = setting.EventTableBulkCopyBatchSize; _bulkCopyTimeout = setting.EventTableBulkCopyTimeout; } Ensure.NotNull(_connectionString, "_connectionString"); Ensure.NotNull(_tableName, "_tableName"); Ensure.NotNull(_versionIndexName, "_versionIndexName"); Ensure.NotNull(_commandIndexName, "_commandIndexName"); Ensure.Positive(_bulkCopyBatchSize, "_bulkCopyBatchSize"); Ensure.Positive(_bulkCopyTimeout, "_bulkCopyTimeout"); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _eventSerializer = ObjectContainer.Resolve<IEventSerializer>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); SupportBatchAppendEvent = true; }
public SqlServerEventStore(OptionSetting optionSetting) { Ensure.NotNull(optionSetting, "optionSetting"); _connectionString = optionSetting.GetOptionValue<string>("ConnectionString"); _tableName = optionSetting.GetOptionValue<string>("TableName"); _primaryKeyName = optionSetting.GetOptionValue<string>("PrimaryKeyName"); _commandIndexName = optionSetting.GetOptionValue<string>("CommandIndexName"); _bulkCopyBatchSize = optionSetting.GetOptionValue<int>("BulkCopyBatchSize"); _bulkCopyTimeout = optionSetting.GetOptionValue<int>("BulkCopyTimeout"); Ensure.NotNull(_connectionString, "_connectionString"); Ensure.NotNull(_tableName, "_tableName"); Ensure.NotNull(_primaryKeyName, "_primaryKeyName"); Ensure.NotNull(_commandIndexName, "_commandIndexName"); Ensure.Positive(_bulkCopyBatchSize, "_bulkCopyBatchSize"); Ensure.Positive(_bulkCopyTimeout, "_bulkCopyTimeout"); _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>(); _eventSerializer = ObjectContainer.Resolve<IEventSerializer>(); _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
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); }
public SendQueueMessageService() { _ioHelper = ObjectContainer.Resolve<IOHelper>(); }
public SendQueueMessageService() { _ioHelper = ObjectContainer.Resolve<IOHelper>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }