/// <summary> /// Sets the receive timeout on the service bus endpoint receiver. Settings this to a lower value has limited /// benefit other than in unit testing to reduce bus disposal time /// </summary> /// <param name="configurator"></param> /// <param name="receiveTimeout"></param> public static IServiceBusConfigurator SetReceiveTimeout(this IServiceBusConfigurator configurator, TimeSpan receiveTimeout) { var controlBusConfigurator = new PostCreateBusBuilderConfigurator(bus => { bus.ReceiveTimeout = receiveTimeout; }); configurator.AddBusConfigurator(controlBusConfigurator); return(configurator); }
public static IServiceBusConfigurator SetConcurrentConsumerLimit(this IServiceBusConfigurator configurator, int concurrentConsumerLimit) { var controlBusConfigurator = new PostCreateBusBuilderConfigurator(bus => { bus.MaximumConsumerThreads = concurrentConsumerLimit; }); configurator.AddBusConfigurator(controlBusConfigurator); return(configurator); }
public static IServiceBusConfigurator SetShutdownTimeout(this IServiceBusConfigurator configurator, TimeSpan timeout) { var controlBusConfigurator = new PostCreateBusBuilderConfigurator(bus => { bus.ShutdownTimeout = timeout; }); configurator.AddBusConfigurator(controlBusConfigurator); return(configurator); }
public static IServiceBusConfigurator AddService <TService>(this IServiceBusConfigurator configurator, IBusServiceLayer layer, Func <TService> serviceFactory) where TService : IBusService { var serviceConfigurator = new DefaultBusServiceConfigurator <TService>(layer, bus => serviceFactory()); configurator.AddBusConfigurator(serviceConfigurator); return(configurator); }
/// <summary> /// Create a control bus, associate it with the ServiceBus being configured, and allow for customization using /// the specified method. /// </summary> /// <param name="configurator"></param> /// <param name="configure"></param> public static IServiceBusConfigurator UseControlBus(this IServiceBusConfigurator configurator, Action <IControlBusConfigurator> configure) { var controlBusConfigurator = new ControlBusConfigurator(); configure(controlBusConfigurator); configurator.AddBusConfigurator(controlBusConfigurator); return(configurator); }
public static IServiceBusConfigurator EnableRemoteIntrospection(this IServiceBusConfigurator configurator) { var serviceConfigurator = new IntrospectionServiceConfigurator(); var busConfigurator = new CustomBusServiceConfigurator(serviceConfigurator); configurator.AddBusConfigurator(busConfigurator); return(configurator); }
public static IServiceBusConfigurator Subscribe(this IServiceBusConfigurator configurator, Action <ISubscriptionBusServiceConfigurator> configure) { var subscriptionConfigurator = new SubscriptionBusServiceConfigurator(); configure(subscriptionConfigurator); configurator.AddBusConfigurator(subscriptionConfigurator); return(configurator); }
/// <summary> /// Specifies that the service bus will be using health monitoring. This means that /// the bus will publish heart beats and respond to ping messages. For more information, /// see http://readthedocs.org/docs/masstransit/en/latest/overview/standardservices.html /// </summary> /// <param name="configurator">Configurator that the extension method is invoked upon.</param> /// <param name="heartbeatInterval">The heartbeat interval in seconds (one heartbeat evey n seconds)</param> public static IServiceBusConfigurator UseHealthMonitoring(this IServiceBusConfigurator configurator, int heartbeatInterval) { var serviceConfigurator = new HealthClientConfigurator(); serviceConfigurator.SetHeartbeatInterval(heartbeatInterval); var busConfigurator = new CustomBusServiceConfigurator(serviceConfigurator); configurator.AddBusConfigurator(busConfigurator); return(configurator); }
/// <summary> /// Adds an inbound message interceptor to the bus configuration /// </summary> /// <param name="configurator"></param> /// <param name="interceptor"></param> public static IServiceBusConfigurator AddInboundInterceptor(this IServiceBusConfigurator configurator, IInboundMessageInterceptor interceptor) { var builderConfigurator = new PostCreateBusBuilderConfigurator(bus => { var interceptorConfigurator = new InboundMessageInterceptorConfigurator(bus.InboundPipeline); interceptorConfigurator.Create(interceptor); }); configurator.AddBusConfigurator(builderConfigurator); return(configurator); }
public static IServiceBusConfigurator EnableMessageTracing(this IServiceBusConfigurator configurator) { var busConfigurator = new PostCreateBusBuilderConfigurator(bus => { var service = new MessageTraceBusService(bus.EventChannel); bus.AddService(IBusServiceLayer.Presentation, service); }); configurator.AddBusConfigurator(busConfigurator); return(configurator); }
/// <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); }