Example #1
0
        public Task Insert(T t)
        {
            var repoTask = _decorated.Insert(t);
            var hubTask  = _context.SendToGroup(s_featureName, t, false);

            return(Task.WhenAll(repoTask, hubTask));
        }
Example #2
0
        public async Task Handle(IEventWrapper <IInstrumentPricingPublished> wrapper, CancellationToken cancellationToken)
        {
            var @event = wrapper.Content;

            var instrument = await _db.FindAsync <Instrument>(@event.InstrumentId);

            var dto = new Dto
            {
                AsAtDate      = wrapper.Timestamp.ToDateTimeUtc(),
                AsOfDate      = @event.AsOfDate,
                Id            = wrapper.AggregateId,
                Instrument    = instrument.Description,
                PriceType     = @event.PriceType,
                PriceCurrency = @event.PriceCurrency,
                PriceAmount   = @event.PriceAmount,
                Vendor        = instrument.Vendor
            };
            var task = _socketContext.SendToGroup(nameof(GetPricesOverView), dto);

            _db.Add(dto);
            await task;
        }