/// <summary>
        /// Adds the given routing function - should return <see cref="ForwardAction.None"/> to do nothing, or another action
        /// available on <see cref="ForwardAction"/> in order to do something to the message
        /// </summary>
        public static void AddTransportMessageForwarder(this StandardConfigurer<IRouter> configurer, Func<TransportMessage, Task<ForwardAction>> routingFunction)
        {
            configurer.OtherService<IPipeline>()
                .Decorate(c =>
                {
                    var pipeline = c.Get<IPipeline>();
                    var transport = c.Get<ITransport>();

                    var stepToAdd = new ForwardTransportMessageStep(routingFunction, transport);

                    return new PipelineStepConcatenator(pipeline)
                        .OnReceive(stepToAdd, PipelineAbsolutePosition.Front);
                });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the given routing function - should return <see cref="ForwardAction.None"/> to do nothing, or another action
        /// available on <see cref="ForwardAction"/> in order to do something to the message
        /// </summary>
        public static void AddTransportMessageForwarder(this StandardConfigurer <IRouter> configurer, Func <TransportMessage, Task <ForwardAction> > routingFunction)
        {
            configurer.OtherService <IPipeline>()
            .Decorate(c =>
            {
                var pipeline           = c.Get <IPipeline>();
                var transport          = c.Get <ITransport>();
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();

                var stepToAdd = new ForwardTransportMessageStep(routingFunction, transport, rebusLoggerFactory);

                return(new PipelineStepConcatenator(pipeline)
                       .OnReceive(stepToAdd, PipelineAbsolutePosition.Front));
            });
        }
        /// <summary>
        /// Adds the given routing function - should return <see cref="ForwardAction.None"/> to do nothing, or another action
        /// available on <see cref="ForwardAction"/> in order to do something to the message
        /// </summary>
        public static void AddTransportMessageForwarder(this StandardConfigurer <IRouter> configurer,
                                                        Func <TransportMessage, Task <ForwardAction> > routingFunction,
                                                        ErrorBehavior errorBehavior)
        {
            configurer.OtherService <IPipeline>()
            .Decorate(c =>
            {
                var pipeline           = c.Get <IPipeline>();
                var transport          = c.Get <ITransport>();
                var rebusLoggerFactory = c.Get <IRebusLoggerFactory>();

                var errorQueueName = c.Has <SimpleRetryStrategySettings>()
                        ? c.Get <SimpleRetryStrategySettings>().ErrorQueueAddress
                        : "error";

                var stepToAdd = new ForwardTransportMessageStep(routingFunction, transport, rebusLoggerFactory, errorQueueName, errorBehavior);

                return(new PipelineStepConcatenator(pipeline)
                       .OnReceive(stepToAdd, PipelineAbsolutePosition.Front));
            });
        }