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 => { }); } }
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 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 Setup() { _pipe = PipeSegment.Input(PipeSegment.End <object>()); _subscriptionScope = _pipe.NewSubscriptionScope(); _called = new ManualResetEvent(false); _subscriptionScope.Subscribe <ClaimModified>(x => _called.Set()); EstablishContext(); }
private void InitializePerformanceCounters() { try { var instanceName = string.Format("{0}_{1}_{2}", Endpoint.Address.Path, Endpoint.Uri.Scheme, Endpoint.Uri.Host); _counters = new ServiceBusInstancePerformanceCounters(instanceName); _eventAggregatorScope.Subscribe <MessageReceived>(message => { _counters.ReceiveCount.Increment(); _counters.ReceiveRate.Increment(); _counters.ReceiveDuration.IncrementBy((long)message.ReceiveDuration.TotalMilliseconds); _counters.ReceiveDurationBase.Increment(); _counters.ConsumerDuration.IncrementBy((long)message.ConsumeDuration.TotalMilliseconds); _counters.ConsumerDurationBase.Increment(); }); _eventAggregatorScope.Subscribe <MessagePublished>(message => { _counters.PublishCount.Increment(); _counters.PublishRate.Increment(); _counters.PublishDuration.IncrementBy((long)message.Duration.TotalMilliseconds); _counters.PublishDurationBase.Increment(); _counters.SentCount.IncrementBy(message.ConsumerCount); _counters.SendRate.IncrementBy(message.ConsumerCount); }); _eventAggregatorScope.Subscribe <ThreadPoolEvent>(message => { _counters.ReceiveThreadCount.Set(message.ReceiverCount); _counters.ConsumerThreadCount.Set(message.ConsumerCount); }); } catch (Exception ex) { _log.Warn("The performance counters could not be created", ex); } }
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 Stop() { _enabled = false; if (_log.IsDebugEnabled) { _log.DebugFormat("Stopping Consumer Pool for {0}", _bus.Endpoint.Uri); } if (_consumerCount == 0) { return; } var completed = new AutoResetEvent(true); _scope.Subscribe <ConsumeCompleted>(x => completed.Set()); while (completed.WaitOne(60.Seconds(), true)) { if (_log.IsDebugEnabled) { _log.DebugFormat("Consumer Pool stopped for {0}", _bus.Endpoint.Uri); } if (_consumerCount == 0) { return; } } if (_log.IsDebugEnabled) { _log.DebugFormat("Timeout stopping Consumer Pool for {0}", _bus.Endpoint.Uri); } }
public void Subscribe <T>(Action <T> actOnEvent) where T : class { _scope.Subscribe(new DelegatingConsumer <T>(actOnEvent)); }
public IMessenger Subscribe <T>(T consumer) where T : class { mySubscriptionScope.Subscribe(consumer); return(this); }
public void Multiple_consumers_should_create_a_recipient_list() { _scope.Subscribe <ClaimModified>(x => { }); _pipe.Send(new ClaimCreated()); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End <ClaimModified>()); _scope = _pipe.NewSubscriptionScope(); _scope.Subscribe <ClaimModified>(x => { }); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End<ClaimModified>()); _scope = _pipe.NewSubscriptionScope(); _scope.Subscribe<ClaimModified>(x => { }); }