Esempio n. 1
0
        public override async Task OnActivateAsync()
        {
            await base.OnActivateAsync();

            ConcurrentChannel = ServiceProvider.GetService <IMpscChannel <ConcurrentTransport <Snapshot <PrimaryKey, SnapshotType> > > >();
            ConcurrentChannel.BindConsumer(ConcurrentExecuter);
        }
Esempio n. 2
0
        public override async Task OnActivateAsync()
        {
            await base.OnActivateAsync();

            ConcurrentChannel = ServiceProvider.GetService <IMpscChannel <ConcurrentTransport <Snapshot <PrimaryKey, SnapshotType> > > >();
            ConcurrentChannel.BindConsumer(BatchInputProcessing).ActiveConsumer();
        }
Esempio n. 3
0
 public EventStorage(IServiceProvider serviceProvider, StorageConfig grainConfig)
 {
     serializer  = serviceProvider.GetService <ISerializer>();
     logger      = serviceProvider.GetService <ILogger <EventStorage <PrimaryKey> > >();
     mpscChannel = serviceProvider.GetService <IMpscChannel <DataAsyncWrapper <SaveTransport <PrimaryKey>, bool> > >();
     mpscChannel.BindConsumer(BatchProcessing).ActiveConsumer();
     this.grainConfig = grainConfig;
 }
Esempio n. 4
0
 public EventStorage(IServiceProvider serviceProvider, StorageOptions grainConfig)
 {
     serializer  = serviceProvider.GetService <ISerializer>();
     logger      = serviceProvider.GetService <ILogger <EventStorage <PrimaryKey> > >();
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <BatchAppendTransport <PrimaryKey>, bool> > >();
     mpscChannel.BindConsumer(BatchProcessing);
     this.grainConfig = grainConfig;
 }
Esempio n. 5
0
 public EventStorage(IServiceProvider serviceProvider, StorageOptions config)
 {
     logger      = serviceProvider.GetService <ILogger <EventStorage <PrimaryKey> > >();
     serializer  = serviceProvider.GetService <ISerializer>();
     mpscChannel = serviceProvider.GetService <IMpscChannel <AsyncInputEvent <BatchAppendTransport <PrimaryKey>, bool> > >();
     mpscChannel.BindConsumer(BatchInsertExecuter);
     this.config = config;
 }
Esempio n. 6
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();
 }
Esempio n. 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(BatchProcessing);
 }
Esempio n. 8
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);
 }
Esempio n. 9
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;
 }
Esempio n. 10
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)";
 }