Example #1
0
        /// <summary>
        /// Specifies that RabbitMQ should be added as a transport for the service bus. Includes a callback
        /// that can configure additional settings on the transport, such as SSL.
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="configureFactory"></param>
        /// <returns></returns>
        public static IServiceBusConfigurator UseRabbitMq(this IServiceBusConfigurator configurator,
                                                          Action <ITransportFactoryConfigurator> configureFactory)
        {
            configurator.SetSubscriptionObserver((bus, coordinator) => new RabbitSubscriptionBinder(bus));

            var busConfigurator = new PostCreateBusBuilderConfigurator(bus =>
            {
                var interceptorConfigurator = new OutboundMessageInterceptorConfigurator(bus.OutboundPipeline);

                // make sure we publish correctly through this interceptor; works on the outgoing pipeline
                interceptorConfigurator.Create(new PublishEndpointInterceptor(bus));
            });

            configurator.AddBusConfigurator(busConfigurator);

            UseRabbitMq((IEndpointFactoryConfigurator)configurator, configureFactory);

            return(configurator);
        }