Beispiel #1
0
        public async Task Send(ConsumeContext <RoutingSlip> context, IPipe <ConsumeContext <RoutingSlip> > next)
        {
            Stopwatch timer = Stopwatch.StartNew();

            try
            {
                CompensateContext <TLog> compensateContext = new HostCompensateContext <TLog>(HostMetadataCache.Host, context);

                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Host: {0} Activity: {1} Compensating: {2}", context.ReceiveContext.InputAddress, TypeMetadataCache <TActivity> .ShortName,
                                     compensateContext.TrackingNumber);
                }

                await _activityFactory.Compensate(compensateContext, _compensatePipe).ConfigureAwait(false);

                await context.NotifyConsumed(timer.Elapsed, TypeMetadataCache <TActivity> .ShortName).ConfigureAwait(false);

                await next.Send(context).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                await context.NotifyFaulted(timer.Elapsed, TypeMetadataCache <TActivity> .ShortName, ex).ConfigureAwait(false);

                throw;
            }
        }
Beispiel #2
0
 public Task Compensate(CompensateContext <TLog> context, IPipe <CompensateActivityContext <TActivity, TLog> > next)
 {
     return(_compensateFactory.Compensate(context, next));
 }
Beispiel #3
0
 public Task <ResultContext <CompensationResult> > Compensate(CompensateContext <TLog> context, IRequestPipe <CompensateActivityContext <TActivity, TLog>, CompensationResult> next)
 {
     return(_factory.Compensate(context, next));
 }