/// <summary> /// Creates an instance of the ServiceBus, which implements IServiceBus. This is normally /// not called and should be created using the ServiceBusConfigurator to ensure proper defaults /// and operation. /// </summary> public ServiceBus(IEndpoint endpointToListenOn, IObjectBuilder objectBuilder, IEndpointFactory endpointFactory) { ReceiveTimeout = TimeSpan.FromSeconds(3); endpointToListenOn.MustNotBeNull("endpointToListenOn", "This parameter cannot be null"); objectBuilder.MustNotBeNull("objectBuilder", "This parameter cannot be null"); endpointFactory.MustNotBeNull("endpointFactory", "This parameter cannot be null"); Endpoint = endpointToListenOn; ObjectBuilder = objectBuilder; EndpointFactory = endpointFactory; _eventAggregator = PipeSegment.New(); _eventAggregatorScope = _eventAggregator.NewSubscriptionScope(); _serviceContainer = new ServiceContainer(this); OutboundPipeline = MessagePipelineConfigurator.CreateDefault(ObjectBuilder, this); InboundPipeline = MessagePipelineConfigurator.CreateDefault(ObjectBuilder, this); InboundPipeline.Configure(x => { _unsubscribeEventDispatchers += x.Register(new InboundOutboundSubscriptionBinder(OutboundPipeline, Endpoint)); }); PoisonEndpoint = new PoisonEndpointDecorator(new NullEndpoint()); ControlBus = this; InitializePerformanceCounters(); }
public void Start(IServiceBus bus) { if (bus == null) { throw new ArgumentNullException("bus"); } _bus = bus; _pipeline = _bus.OutboundPipeline; _unregisterAction = _service.Register(this); }
public void Start(IServiceBus bus) { _bus = bus; _unregisterAction = _bus.Configure(x => { UnregisterAction unregisterAction = x.Register(this); return(() => unregisterAction()); }); }
public static UnregisterAction Filter <TMessage>(this IMessagePipeline pipeline, string description, Func <TMessage, bool> allow) where TMessage : class { MessageFilterConfigurator configurator = MessageFilterConfigurator.For(pipeline); var filter = configurator.Create(description, allow); UnregisterAction result = () => { throw new NotSupportedException("Removal of filters not yet supported"); }; return(result); }
void ListenToBus(IServiceBus bus) { var subscriptionEventListener = new BusSubscriptionEventListener(bus, this); _unregister += bus.Configure(x => { UnregisterAction unregisterAction = x.Register(subscriptionEventListener); return(() => unregisterAction()); }); _listeners.Add(subscriptionEventListener); IServiceBus controlBus = bus.ControlBus; if (controlBus != bus) { ListenToBus(controlBus); } }
public void Start(IServiceBus bus) { _bus = bus; _pipeline = _bus.OutboundPipeline; _unregisterAction = _service.Register(this); }
public void Start(IServiceBus bus) { _bus = bus; _unregisterAction = _bus.InboundPipeline.Configure(x => x.Register(this)); }