public void Setup() { Input = PipeSegment.Input(PipeSegment.End()); Scope = Input.NewSubscriptionScope(); EstablishContext(); }
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 Should_display_an_InputSegment() { var end = PipeSegment.End <object>(); Pipe input = PipeSegment.Input(end); new TracePipeVisitor().Trace(input); }
private void RegisterApplicationServices(IContainer container) { var pipe = PipeSegment.Input(PipeSegment.End()); container.RegisterAsSingleton((Pipe)pipe); container.RegisterAsSingleton <IEventsProvider, EventsProvider>(); }
public StraightThroughPipelineRunner() { Pipe consumer = PipeSegment.Consumer <ClaimModified>(m => Interlocked.Increment(ref _count)); _input = PipeSegment.Input(consumer); _message = new ClaimModified(); }
public void Setup() { Input = PipeSegment.Input(PipeSegment.End <object>()); BeforeCalled = new ManualResetEvent(false); AfterCalled = new ManualResetEvent(false); EstablishContext(); }
public void Setup() { _received = new ManualResetEvent(false); var recipients = new Pipe[] {}; var recipientList = PipeSegment.RecipientList <object>(recipients); _pipe = PipeSegment.Input(recipientList); }
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 Should_display_a_complex_segment_chain() { var consumer = PipeSegment.Consumer <ClaimModified>(x => { }); var end = PipeSegment.End <ClaimModified>(); var recipientList = PipeSegment.RecipientList <ClaimModified>(new Pipe[] { consumer, end }); var filter = PipeSegment.Filter <object>(recipientList); Pipe input = PipeSegment.Input(filter); new TracePipeVisitor().Trace(input); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End <object>()); _subscriptionScope = _pipe.NewSubscriptionScope(); _called = new ManualResetEvent(false); _subscriptionScope.Subscribe <ClaimModified>(x => _called.Set()); EstablishContext(); }
public RecipientListPipelineRunner() { Pipe consumer = PipeSegment.Consumer <ClaimModified>(m => Interlocked.Increment(ref _count)); Pipe consumer2 = PipeSegment.Consumer <ClaimModified>(m => Interlocked.Increment(ref _count2)); var recipients = new[] { consumer, consumer2 }; Pipe recipientList = PipeSegment.RecipientList <ClaimModified>(recipients); Pipe filter = PipeSegment.Filter <object>(recipientList); Pipe objectRecipientList = PipeSegment.RecipientList <object>(new[] { filter }); _input = PipeSegment.Input(objectRecipientList); _message = new ClaimModified(); }
public void Should_contain_all_nodes() { MessageConsumerSegment consumer = PipeSegment.Consumer <SomethingHappenedEvent>(x => { }); EndSegment end = PipeSegment.End <SomethingHappenedEvent>(); RecipientListSegment recipientList = PipeSegment.RecipientList <SomethingHappenedEvent>(new Pipe[] { consumer, end }); FilterSegment filter = PipeSegment.Filter <object>(recipientList); Pipe input = PipeSegment.Input(filter); //var generator = new PipelineGraphGenerator(); //string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "graph.png"); //generator.SaveGraphToFile(input.GetGraphData(), 2560, 1920, filename); PipelineDebugVisualizer.TestShowVisualizer(input.GetGraphData()); }
public void How_many_messages_can_the_pipe_send_per_second() { _count = 0; _count2 = 0; _limit = 5000000; Pipe consumer = PipeSegment.Consumer <ClaimModified>(m => { Interlocked.Increment(ref _count); }); Pipe consumer2 = PipeSegment.Consumer <ClaimModified>(m => { Interlocked.Increment(ref _count2); }); var recipients = new[] { consumer, consumer2 }; Pipe recipientList = PipeSegment.RecipientList <ClaimModified>(recipients); Pipe filter = PipeSegment.Filter <object>(recipientList); Pipe objectRecipientList = PipeSegment.RecipientList <object>(new[] { filter }); _input = PipeSegment.Input(objectRecipientList); var message = new ClaimModified(); for (int i = 0; i < 100; i++) { _input.Send(message); } _count = 0; _count2 = 0; Thread pusherThread = new Thread(Pusher); Thread pusherThread2 = new Thread(Pusher); Stopwatch timer = Stopwatch.StartNew(); pusherThread.Start(); pusherThread2.Start(); pusherThread.Join(10000); pusherThread2.Join(1000); timer.Stop(); Trace.WriteLine("Received: " + (_count + _count2) + ", expected " + _limit * 2); Trace.WriteLine("Elapsed Time: " + timer.ElapsedMilliseconds + "ms"); Trace.WriteLine("Messages Per Second: " + _limit * 1000 / timer.ElapsedMilliseconds); }
public EventsProvider() { _eventsPipe = PipeSegment.Input(PipeSegment.End());; _scope = _eventsPipe.NewSubscriptionScope(); }
public AppFrameRegistry() { ForRequestedType <Pipe>() .CacheBy(InstanceScope.Singleton) .TheDefault.Is.ConstructedBy(x => PipeSegment.Input(PipeSegment.End())); }
static MagnumMessenger() { myMessageBus = PipeSegment.Input(PipeSegment.End()); mySubscriptionScope = myMessageBus.NewSubscriptionScope(); }
public static Pipe New(this Pipe ignored) { return(PipeSegment.Input(PipeSegment.End())); }
public void First_example() { _eventAggregator = PipeSegment.Input(PipeSegment.End()); _eventAggregator.Send(new CustomerRatingDowngraded()); }
public void Setup() { _received = new ManualResetEvent(false); _pipe = PipeSegment.Input(PipeSegment.End()); }
public MagnumMessenger() { _messageBus = PipeSegment.Input(PipeSegment.End()); _subscriptionScope = _messageBus.NewSubscriptionScope(); }
public void Setup() { _pipe = PipeSegment.Input(PipeSegment.End <ClaimModified>()); _scope = _pipe.NewSubscriptionScope(); _scope.Subscribe <ClaimModified>(x => { }); }