Example #1
0
        public void Setup()
        {
            Input = PipeSegment.Input(PipeSegment.End());
            Scope = Input.NewSubscriptionScope();

            EstablishContext();
        }
Example #2
0
        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 => { });
            }
        }
Example #3
0
        public void Should_display_an_InputSegment()
        {
            var  end   = PipeSegment.End <object>();
            Pipe input = PipeSegment.Input(end);

            new TracePipeVisitor().Trace(input);
        }
Example #4
0
        private void RegisterApplicationServices(IContainer container)
        {
            var pipe = PipeSegment.Input(PipeSegment.End());

            container.RegisterAsSingleton((Pipe)pipe);
            container.RegisterAsSingleton <IEventsProvider, EventsProvider>();
        }
Example #5
0
        public StraightThroughPipelineRunner()
        {
            Pipe consumer = PipeSegment.Consumer <ClaimModified>(m => Interlocked.Increment(ref _count));

            _input = PipeSegment.Input(consumer);

            _message = new ClaimModified();
        }
Example #6
0
        public void Setup()
        {
            Input        = PipeSegment.Input(PipeSegment.End <object>());
            BeforeCalled = new ManualResetEvent(false);
            AfterCalled  = new ManualResetEvent(false);

            EstablishContext();
        }
Example #7
0
        public void Setup()
        {
            _received = new ManualResetEvent(false);

            var recipients    = new Pipe[] {};
            var recipientList = PipeSegment.RecipientList <object>(recipients);

            _pipe = PipeSegment.Input(recipientList);
        }
Example #8
0
        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);
        }
Example #9
0
        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);
        }
Example #10
0
        public void Setup()
        {
            _pipe = PipeSegment.Input(PipeSegment.End <object>());
            _subscriptionScope = _pipe.NewSubscriptionScope();

            _called = new ManualResetEvent(false);
            _subscriptionScope.Subscribe <ClaimModified>(x => _called.Set());

            EstablishContext();
        }
Example #11
0
        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();
        }
Example #12
0
        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());
        }
Example #13
0
        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);
        }
Example #14
0
 public EventsProvider()
 {
     _eventsPipe = PipeSegment.Input(PipeSegment.End());;
     _scope      = _eventsPipe.NewSubscriptionScope();
 }
Example #15
0
 public AppFrameRegistry()
 {
     ForRequestedType <Pipe>()
     .CacheBy(InstanceScope.Singleton)
     .TheDefault.Is.ConstructedBy(x => PipeSegment.Input(PipeSegment.End()));
 }
Example #16
0
 static MagnumMessenger()
 {
     myMessageBus        = PipeSegment.Input(PipeSegment.End());
     mySubscriptionScope = myMessageBus.NewSubscriptionScope();
 }
Example #17
0
 public static Pipe New(this Pipe ignored)
 {
     return(PipeSegment.Input(PipeSegment.End()));
 }
Example #18
0
        public void First_example()
        {
            _eventAggregator = PipeSegment.Input(PipeSegment.End());

            _eventAggregator.Send(new CustomerRatingDowngraded());
        }
Example #19
0
        public void Setup()
        {
            _received = new ManualResetEvent(false);

            _pipe = PipeSegment.Input(PipeSegment.End());
        }
Example #20
0
 public MagnumMessenger()
 {
     _messageBus        = PipeSegment.Input(PipeSegment.End());
     _subscriptionScope = _messageBus.NewSubscriptionScope();
 }
Example #21
0
 public void Setup()
 {
     _pipe  = PipeSegment.Input(PipeSegment.End <ClaimModified>());
     _scope = _pipe.NewSubscriptionScope();
     _scope.Subscribe <ClaimModified>(x => { });
 }