public void Setup() { _addCalled = new Future <bool>(); _removeCalled = new Future <bool>(); _input = PipeSegment.Input(PipeSegment.End()); _subscriberScope = _input.NewSubscriptionScope(); _subscriberScope.Subscribe <SubscriberAdded>(x => { if (x.MessageType == typeof(ClaimModified)) { _addCalled.Complete(true); } }); _subscriberScope.Subscribe <SubscriberRemoved>(x => { if (x.MessageType == typeof(ClaimModified)) { _removeCalled.Complete(true); } }); using (ISubscriptionScope scope = _input.NewSubscriptionScope()) { scope.Subscribe <ClaimModified>(x => { }); } }
public void Setup() { Input = PipeSegment.Input(PipeSegment.End()); Scope = Input.NewSubscriptionScope(); EstablishContext(); }
/// <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(); }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_consumerPool != null) { _consumerPool.Stop(); _consumerPool.Dispose(); _consumerPool = null; } if (_serviceContainer != null) { _serviceContainer.Stop(); _serviceContainer.Dispose(); _serviceContainer = null; } if (ControlBus != this) { ControlBus.Dispose(); } _unsubscribeEventDispatchers(); InboundPipeline.Dispose(); InboundPipeline = null; OutboundPipeline.Dispose(); OutboundPipeline = null; if (_eventAggregatorScope != null) { _eventAggregatorScope.Dispose(); _eventAggregatorScope = null; } _eventAggregator = null; Endpoint = null; if (_counters != null) { _counters.Dispose(); _counters = null; } if (PoisonEndpoint != null) { PoisonEndpoint = null; } } _disposed = true; }
public void Second_example() { _eventAggregator = PipeSegment.Input(PipeSegment.End()); _scope = _eventAggregator.NewSubscriptionScope(); _scope.Subscribe <CustomerChanged>(message => Trace.WriteLine("Customer changed: " + message.CustomerName)); new TracePipeVisitor().Trace(_eventAggregator); }
public void Second_example() { _eventAggregator = PipeSegment.Input(PipeSegment.End()); _scope = _eventAggregator.NewSubscriptionScope(); _scope.Subscribe<CustomerChanged>(message => Trace.WriteLine("Customer changed: " + message.CustomerName)); new TracePipeVisitor().Trace(_eventAggregator); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End<object>()); _subscriptionScope = _pipe.NewSubscriptionScope(); _called = new ManualResetEvent(false); _subscriptionScope.Subscribe<ClaimModified>(x => _called.Set()); EstablishContext(); }
public void Teardown() { if(_scope != null) { _scope.Dispose(); _scope = null; } _eventAggregator = null; }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End <object>()); _subscriptionScope = _pipe.NewSubscriptionScope(); _called = new ManualResetEvent(false); _subscriptionScope.Subscribe <ClaimModified>(x => _called.Set()); EstablishContext(); }
public void Teardown() { if (_scope != null) { _scope.Dispose(); _scope = null; } _eventAggregator = null; }
public void Start() { _scope = _eventAggregator.NewSubscriptionScope(); _scope.Subscribe<ReceiveCompleted>(Handle); _scope.Subscribe<ConsumeCompleted>(Handle); _enabled = true; if (_log.IsDebugEnabled) _log.DebugFormat("Starting Consumer Pool for {0}", _bus.Endpoint.Uri); QueueReceiver(); }
public void Start() { _scope = _eventAggregator.NewSubscriptionScope(); _scope.Subscribe <ReceiveCompleted>(Handle); _scope.Subscribe <ConsumeCompleted>(Handle); _enabled = true; if (_log.IsDebugEnabled) { _log.DebugFormat("Starting Consumer Pool for {0}", _bus.Endpoint.Uri); } QueueReceiver(); }
public void Setup() { _addCalled = new Future<bool>(); _removeCalled = new Future<bool>(); _input = PipeSegment.Input(PipeSegment.End()); _subscriberScope = _input.NewSubscriptionScope(); _subscriberScope.Subscribe<SubscriberAdded>(x => _addCalled.Complete(true)); _subscriberScope.Subscribe<SubscriberRemoved>(x => _removeCalled.Complete(true)); using (var scope = _input.NewSubscriptionScope()) { scope.Subscribe<ClaimModified>(x => { }); } }
private void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_scope != null) { _scope.Dispose(); _scope = null; } } _disposed = true; }
public void Setup() { _addCalled = new Future<bool>(); _removeCalled = new Future<bool>(); _input = PipeSegment.Input(PipeSegment.End()); _subscriberScope = _input.NewSubscriptionScope(); _subscriberScope.Subscribe<SubscriberAdded>(x => { if(x.MessageType == typeof(ClaimModified)) _addCalled.Complete(true); }); _subscriberScope.Subscribe<SubscriberRemoved>(x => { if (x.MessageType == typeof(ClaimModified)) _removeCalled.Complete(true); }); using (ISubscriptionScope scope = _input.NewSubscriptionScope()) { scope.Subscribe<ClaimModified>(x => { }); } }
public void Teardown() { _subscriptionScope.Dispose(); _subscriptionScope = null; }
public EventsProvider() { _eventsPipe = PipeSegment.Input(PipeSegment.End());; _scope = _eventsPipe.NewSubscriptionScope(); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End<ClaimModified>()); _scope = _pipe.NewSubscriptionScope(); _scope.Subscribe<ClaimModified>(x => { }); }
static MagnumMessenger() { myMessageBus = PipeSegment.Input(PipeSegment.End()); mySubscriptionScope = myMessageBus.NewSubscriptionScope(); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End <ClaimModified>()); _scope = _pipe.NewSubscriptionScope(); _scope.Subscribe <ClaimModified>(x => { }); }
private void Dispose(bool disposing) { if (_disposed) return; if (disposing) { if (_scope != null) { _scope.Dispose(); _scope = null; } } _disposed = true; }
public MagnumMessenger() { _messageBus = PipeSegment.Input(PipeSegment.End()); _subscriptionScope = _messageBus.NewSubscriptionScope(); }
public EventsProvider(Pipe eventsPipe) { Helper.GuardNotNull(eventsPipe); _eventsPipe = eventsPipe; _scope = _eventsPipe.NewSubscriptionScope(); }