示例#1
0
        public override async Task OnActivateAsync()
        {
            await base.OnActivateAsync();

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

            ConcurrentChannel = ServiceProvider.GetService <IMpscChannel <ConcurrentTransport <Snapshot <PrimaryKey, SnapshotType> > > >();
            ConcurrentChannel.BindConsumer(BatchInputProcessing).ActiveConsumer();
        }
示例#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;
 }
示例#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;
 }
示例#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;
 }
示例#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();
 }
示例#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);
 }
示例#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);
 }
示例#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;
 }
示例#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)";
 }