/// <summary>
        /// Adds a callback filter to the send pipeline
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="callback">The callback to invoke</param>
        public static void UseSendExecute <T>(this ISendPipeConfigurator configurator, Action <SendContext <T> > callback)
            where T : class
        {
            var specification = new DelegatePipeSpecification <SendContext <T> >(callback);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Adds a filter to the send pipeline
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configurator"></param>
        /// <param name="filter"></param>
        public static void UseSendFilter <T>(this ISendPipeConfigurator configurator, IFilter <SendContext <T> > filter)
            where T : class
        {
            var specification = new FilterPipeSpecification <SendContext <T> >(filter);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Apply a transform on send to the message
        /// </summary>
        /// <typeparam name="T">The message type</typeparam>
        /// <param name="configurator">The consume pipe configurator</param>
        /// <param name="configure">The configuration callback</param>
        public static void UseTransform <T>(this ISendPipeConfigurator configurator, Action <ITransformConfigurator <T> > configure)
            where T : class
        {
            var specification = new SendTransformSpecification <T>();

            configure(specification);

            configurator.AddPipeSpecification(specification);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a filter to the send pipe for the specific message type
        /// </summary>
        /// <typeparam name="T">The message type</typeparam>
        /// <param name="configurator">The pipe configurator</param>
        /// <param name="filter">The filter to add</param>
        public static void UseFilter <T>(this ISendPipeConfigurator configurator, IFilter <SendContext <T> > filter)
            where T : class
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var specification = new FilterPipeSpecification <SendContext <T> >(filter);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Adds a callback filter to the send pipeline
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="callback">The callback to invoke</param>
        public static void UseSendExecuteAsync(this ISendPipeConfigurator configurator, Func <SendContext, Task> callback)
        {
            var specification = new AsyncDelegatePipeSpecification <SendContext>(callback);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Adds a callback filter to the send pipeline
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="callback">The callback to invoke</param>
        public static void UseSendExecute(this ISendPipeConfigurator configurator, Action <SendContext> callback)
        {
            var specification = new DelegatePipeSpecification <SendContext>(callback);

            configurator.AddPipeSpecification(specification);
        }
        /// <summary>
        /// Adds a filter to the send pipeline
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configurator"></param>
        /// <param name="filter"></param>
        public static void UseSendFilter(this ISendPipeConfigurator configurator, IFilter <SendContext> filter)
        {
            var specification = new FilterPipeSpecification <SendContext>(filter);

            configurator.AddPipeSpecification(specification);
        }