Exemple #1
0
 public EventStorage(IServiceProvider serviceProvider, StorageOptions config)
 {
     logger      = serviceProvider.GetService <ILogger <EventStorage <PrimaryKey> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     typeFinder  = serviceProvider.GetService <ITypeFinder>();
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <BatchAppendTransport <PrimaryKey>, bool> > >();
     mpscChannel.BindConsumer(BatchInsertExecuter);
     this.config = config;
 }
Exemple #2
0
 public TxEventStorage(IServiceProvider serviceProvider, DbFactory dbFactory, string optionName, string tableName)
 {
     this.dbFactory   = dbFactory;
     this.optionName  = optionName;
     this.tableName   = tableName;
     this.logger      = serviceProvider.GetService <ILogger <TxEventStorage <TPrimaryKey> > >();
     this.mpscChannel = serviceProvider.GetService <IMpscChannel <AskInputBox <EventEntity <TPrimaryKey>, bool> > >();
     this.mpscChannel.BindConsumer(this.BatchInsertExecuter);
 }
Exemple #3
0
 public TransactionStorage(
     IServiceProvider serviceProvider,
     IOptions <TransactionStorageConfig> storageConfig,
     IOptions <SqlConfig> sqlConfig)
 {
     connection  = sqlConfig.Value.ConnectionDict[storageConfig.Value.ConnectionKey];
     mpscChannel = serviceProvider.GetService <IMpscChannel <DataAsyncWrapper <AppendInput, bool> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     mpscChannel.BindConsumer(BatchProcessing);
     mpscChannel.ActiveConsumer();
 }
 public DistributedTxStorage(
     IServiceProvider serviceProvider,
     IOptions <TransactionOptions> options,
     IOptions <SQLServerConnections> connectionsOptions)
 {
     this.options = options;
     connection   = connectionsOptions.Value.ConnectionDict[options.Value.ConnectionKey];
     CreateEventSubRecordTable();
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <AppendInput, bool> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     mpscChannel.BindConsumer(BatchProcessing);
 }
Exemple #5
0
 public TransactionStorage(
     IServiceProvider serviceProvider,
     IOptions <TransactionOptions> transactionOptions,
     IOptions <MongoConnections> connectionsOptions)
 {
     this.transactionOptions = transactionOptions;
     client      = ClientFactory.CreateClient(connectionsOptions.Value.ConnectionDict[transactionOptions.Value.ConnectionKey]);
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <AppendInput, bool> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     serviceProvider.GetService <IIndexBuildService>().CreateTransactionStorageIndex(client, transactionOptions.Value.Database, transactionOptions.Value.CollectionName).GetAwaiter().GetResult();
     mpscChannel.BindConsumer(BatchProcessing);
 }
Exemple #6
0
 public ConsumerRunner(
     IRabbitMQClient client,
     IServiceProvider provider,
     RabbitConsumer consumer,
     QueueInfo queue)
 {
     Client      = client;
     Logger      = provider.GetService <ILogger <ConsumerRunner> >();
     mpscChannel = provider.GetService <IMpscChannel <BasicDeliverEventArgs> >();
     mpscChannel.BindConsumer(BatchExecuter);
     Consumer = consumer;
     Queue    = queue;
 }
Exemple #7
0
 public DistributedTxStorage(
     IServiceProvider serviceProvider,
     IOptions <TransactionOptions> options,
     IOptions <SQLServerConnections> connectionsOptions)
 {
     this.options = options;
     connection   = connectionsOptions.Value.ConnectionDict[options.Value.ConnectionKey];
     CreateEventSubRecordTable();
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <AppendInput, bool> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     mpscChannel.BindConsumer(BatchInsertExecuter);
     delete_sql      = $"delete from {options.Value.TableName} WHERE UnitName=@UnitName and TransactionId=@TransactionId";
     select_list_sql = $"select * from {options.Value.TableName} WHERE UnitName=@UnitName";
     update_sql      = $"update {options.Value.TableName} set Status=@Status where UnitName=@UnitName and TransactionId=@TransactionId";
     insert_sql      = $"INSERT INTO {options.Value.TableName}(UnitName,TransactionId,Data,Status) VALUES(@UnitName,@TransactionId,@Data,@Status)";
 }
Exemple #8
0
 public override Task OnActivateAsync()
 {
     ConcurrentChannel = ServiceProvider.GetService <IMpscChannel <AsyncInputEvent <IFullyEvent <PrimaryKey>, bool> > >().BindConsumer(BatchInputProcessing);
     return(base.OnActivateAsync());
 }