Exemple #1
0
        internal void AddMeasurement(IIncomingStep step, TimeSpan elapsed)
        {
            var correctedElapsed = Correct(elapsed);
            var stepType         = step.GetType();

            var measurement = new Measurement(stepType, correctedElapsed);

            _measurements.Push(measurement);
        }
Exemple #2
0
        internal void AddMeasurement(IIncomingStep step, TimeSpan elapsed)
        {
            var correctedElapsed = Correct(elapsed);
            var stepType = step.GetType();

            var measurement = new Measurement(stepType, correctedElapsed);

            _measurements.Push(measurement);
        }
Exemple #3
0
        /// <summary>
        /// Configures injection of the given <see cref="IIncomingStep"/>, positioning it relative to another step
        /// specified by <paramref name="anchorStep"/>. The relative position is specified with either
        /// <see cref="PipelineRelativePosition.Before"/> or <see cref="PipelineRelativePosition.After"/>
        /// </summary>
        public PipelineStepInjector OnReceive(IIncomingStep step, PipelineRelativePosition position, Type anchorStep)
        {
            if (step == null) throw new ArgumentNullException(nameof(step));
            if (anchorStep == null) throw new ArgumentNullException(nameof(anchorStep));

            _incomingInjectedSteps
                .GetOrAdd(anchorStep, _ => new List<Tuple<PipelineRelativePosition, IIncomingStep>>())
                .Add(Tuple.Create(position, step));

            return this;
        }
 /// <summary>
 /// Sets the specified receive <paramref name="step"/> to be concatenated at the position specified by <paramref name="position"/>
 /// </summary>
 public PipelineStepConcatenator OnReceive(IIncomingStep step, PipelineAbsolutePosition position)
 {
     if (position == PipelineAbsolutePosition.Front)
     {
         _incomingFrontSteps.Add(step);
     }
     else
     {
         _incomingBackSteps.Add(step);
     }
     return this;
 }
Exemple #5
0
 /// <summary>
 /// Sets the specified receive <paramref name="step"/> to be concatenated at the position specified by <paramref name="position"/>
 /// </summary>
 public PipelineStepConcatenator OnReceive(IIncomingStep step, PipelineAbsolutePosition position)
 {
     if (position == PipelineAbsolutePosition.Front)
     {
         _incomingFrontSteps.Add(step);
     }
     else
     {
         _incomingBackSteps.Add(step);
     }
     return(this);
 }
 /// <summary>
 /// Sets the specified receive <paramref name="step"/> to be concatenated at the position specified by <paramref name="position"/>
 /// </summary>
 public PipelineStepConcatenator OnReceive(IIncomingStep step, PipelineAbsolutePosition position)
 {
     if (step == null) throw new ArgumentNullException(nameof(step));
     if (position == PipelineAbsolutePosition.Front)
     {
         _incomingFrontSteps.Add(step);
     }
     else
     {
         _incomingBackSteps.Add(step);
     }
     return this;
 }
Exemple #7
0
        public static OptionsConfigurer RegisterIncomingStep(this OptionsConfigurer configurer,
                                                             IIncomingStep stepToInject,
                                                             PipelineRelativePosition position = PipelineRelativePosition.Before,
                                                             Type anchorStep = null)
        {
            anchorStep = anchorStep ?? typeof(DispatchIncomingMessageStep);
            configurer.Decorate <IPipeline>(c =>
            {
                var pipeline = c.Get <IPipeline>();

                return(new PipelineStepInjector(pipeline)
                       .OnReceive(stepToInject, position, anchorStep));
            });

            return(configurer);
        }
Exemple #8
0
 /// <summary>
 /// Sets the specified receive <paramref name="step"/> to be concatenated at the position specified by <paramref name="position"/>
 /// </summary>
 public PipelineStepConcatenator OnReceive(IIncomingStep step, PipelineAbsolutePosition position)
 {
     if (step == null)
     {
         throw new ArgumentNullException(nameof(step));
     }
     if (position == PipelineAbsolutePosition.Front)
     {
         _incomingFrontSteps.Add(step);
     }
     else
     {
         _incomingBackSteps.Add(step);
     }
     return(this);
 }
Exemple #9
0
        static void AddRebusWithStep(IServiceCollection serviceCollection, IIncomingStep step)
        {
            serviceCollection.AddRebus(configure => configure
                                       .Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "whatever"))
                                       .Options(o =>
            {
                o.Decorate <IPipeline>(c =>
                {
                    var pipeline = c.Get <IPipeline>();
                    return(new PipelineStepInjector(pipeline)
                           .OnReceive(step, PipelineRelativePosition.After, typeof(SimpleRetryStrategyStep)));
                });

                o.LogPipeline(verbose: true);
            }));
        }
Exemple #10
0
        public async Task TakeTime(IIncomingStep step)
        {
            const int count = 1000000;
            //const int count = 1000;

            var stopwatch = Stopwatch.StartNew();

            await Task.WhenAll(Enumerable.Range(0, count).Select(GetIncomingStepContext)
                               .Select(context => step.Process(context, Noop)));

            var elapsed = stopwatch.Elapsed;

            Console.WriteLine($@"
Step: {step}
Invocations: {count}
Elapsed: {elapsed.TotalSeconds:0.0}
");
        }
 public ProfilerStep(IIncomingStep nextStep)
 {
     _nextStep = nextStep;
 }
Exemple #12
0
 /// <summary>
 /// Adds a new incoming step to the receive pipeline
 /// </summary>
 public DefaultPipeline OnReceive(IIncomingStep step)
 {
     _receiveSteps.Add(step);
     return this;
 }
Exemple #13
0
 public StatsContextDisposable(StatsContext statsContext, IIncomingStep nextStep)
 {
     _statsContext = statsContext;
     _nextStep     = nextStep;
 }
Exemple #14
0
 internal IDisposable Measure(IIncomingStep nextStep)
 {
     return(new StatsContextDisposable(this, nextStep));
 }
Exemple #15
0
 /// <summary>
 /// Adds a new incoming step to the receive pipeline
 /// </summary>
 public DefaultPipeline OnReceive(IIncomingStep step)
 {
     _receiveSteps.Add(step);
     return(this);
 }
Exemple #16
0
 public StatsContextDisposable(StatsContext statsContext, IIncomingStep nextStep)
 {
     _statsContext = statsContext;
     _nextStep = nextStep;
 }
Exemple #17
0
 bool HasMatch(IIncomingStep step)
 {
     return(_incomingStepPredicates.Any(p => p(step)));
 }
Exemple #18
0
 internal IDisposable Measure(IIncomingStep nextStep) => new StatsContextDisposable(this, nextStep);
        /// <summary>
        /// Configures injection of the given <see cref="IIncomingStep"/>, positioning it relative to another step
        /// specified by <paramref name="anchorStep"/>. The relative position is specified with either
        /// <see cref="PipelineRelativePosition.Before"/> or <see cref="PipelineRelativePosition.After"/>
        /// </summary>
        public PipelineStepInjector OnReceive(IIncomingStep step, PipelineRelativePosition position, Type anchorStep)
        {
            if (step == null) throw new ArgumentNullException("step");
            if (anchorStep == null) throw new ArgumentNullException("anchorStep");

            _incomingInjectedSteps
                .GetOrAdd(anchorStep, _ => new List<Tuple<PipelineRelativePosition, IIncomingStep>>())
                .Add(Tuple.Create(position, step));

            return this;
        }
Exemple #20
0
 internal IDisposable Measure(IIncomingStep nextStep)
 {
     return new StatsContextDisposable(this, nextStep);
 }
 bool HasMatch(IIncomingStep step)
 {
     return _incomingStepPredicates.Any(p => p(step));
 }
Exemple #22
0
 public ProfilerStep(IIncomingStep nextStep)
 {
     _nextStep = nextStep;
 }
        public IncomingPipeline Register(IIncomingStep step)
        {
            registeredSteps.Enqueue(step);

            return this;
        }