public List <Operation> CreateFor(ServerEventsBatch batch)
 {
     return(batch.Events.Cast <dynamic>()
            .Select(it => this.CreateOperation(it))
            .Where(it => it != null)
            .Cast <Operation>()
            .ToList());
 }
示例#2
0
        public async Task Handle(ServerEventsBatch batch)
        {
            var commands = this.operationsFactory.CreateFor(batch);

            foreach (var operation in commands)
            {
                this.EnqueOperation(operation);
            }

            await Task.WhenAll(commands.Select(it => it.CompletionSource.Task).ToArray());

            // notify batch completed

            this.aggregator.Publish(new DropBoxBatchCompleted());
        }