Example #1
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;
        }
Example #2
0
        public static OptionsConfigurer RegisterOutgoingStep(this OptionsConfigurer configurer,
                                                             IOutgoingStep stepToInject,
                                                             PipelineRelativePosition position = PipelineRelativePosition.Before,
                                                             Type anchorStep = null)
        {
            anchorStep = anchorStep ?? typeof(SendOutgoingMessageStep);
            configurer.Decorate <IPipeline>(c =>
            {
                var pipeline = c.Get <IPipeline>();

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

            return(configurer);
        }
Example #3
0
        /// <summary>
        /// Configures injection of the given <see cref="IOutgoingStep"/>, 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 OnSend(IOutgoingStep step, PipelineRelativePosition position, Type anchorStep)
        {
            if (step == null)
            {
                throw new ArgumentNullException(nameof(step));
            }
            if (anchorStep == null)
            {
                throw new ArgumentNullException(nameof(anchorStep));
            }

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

            return(this);
        }
        public static OptionsConfigurer RegisterIncomingStep <T>(this OptionsConfigurer configurer,
                                                                 T stepToInject,
                                                                 PipelineRelativePosition position = PipelineRelativePosition.Before,
                                                                 Type anchorStep = null) where T : IIncomingStep
        {
            if (configurer.Has <T>())
            {
                return(configurer);
            }

            anchorStep = anchorStep ?? typeof(DispatchIncomingMessageStep);
            configurer.Decorate <IPipeline>(c =>
            {
                var pipeline = c.Get <IPipeline>();

                return(new PipelineStepInjector(pipeline)
                       .OnReceive(stepToInject, position, anchorStep));
            });
            configurer.Register(context => stepToInject);

            return(configurer);
        }
Example #5
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("step");
            if (anchorStep == null) throw new ArgumentNullException("anchorStep");

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

            return this;
        }
Example #6
0
        /// <summary>
        /// Configures injection of the given <see cref="IOutgoingStep"/>, 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 OnSend(IOutgoingStep step, PipelineRelativePosition position, Type anchorStep)
        {
            if (step == null) throw new ArgumentNullException(nameof(step));
            if (anchorStep == null) throw new ArgumentNullException(nameof(anchorStep));

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

            return this;
        }