Exemple #1
0
 public void should_accept_no_event_stream_response()
 {
     _bus.Handle(
         new ClientMessage.ReadStreamEventsBackwardCompleted(
             _listEventsHandler.HandledMessages[0].CorrelationId,
             _listEventsHandler.HandledMessages[0].EventStreamId, 100, 100, ReadStreamResult.NoStream,
             new ResolvedEvent[0], null, false, string.Empty, -1, -1, true, 1000));
 }
Exemple #2
0
 public void should_accept_no_event_stream_response()
 {
     _bus.Handle(
         new ClientMessage.ReadStreamEventsBackwardCompleted(
             _listEventsHandler.HandledMessages[0].CorrelationId,
             _listEventsHandler.HandledMessages[0].EventStreamId, new EventLinkPair[0],
             RangeReadResult.NoStream, -1, -1, false, 1000));
 }
        private void CommonHandle(Message message)
        {
            if (BlockWriter && !(message is SystemMessage.StateChangeMessage))
            {
                Log.Trace("Blocking message {0} in StorageWriterService. Message:", message.GetType().Name);
                Log.Trace("{0}", message);
                return;
            }

            if (_vnodeState != VNodeState.Master && message is StorageMessage.IMasterWriteMessage)
            {
                var msg = string.Format("{0} appeared in StorageWriter during state {1}.", message.GetType().Name,
                                        _vnodeState);
                Log.Fatal(msg);
                Application.Exit(ExitCode.Error, msg);
                return;
            }

            try
            {
                _writerBus.Handle(message);
            }
            catch (Exception exc)
            {
                BlockWriter = true;
                Log.FatalException(exc, "Unexpected error in StorageWriterService. Terminating the process...");
                Application.Exit(ExitCode.Error,
                                 string.Format("Unexpected error in StorageWriterService: {0}", exc.Message));
            }
        }
        public void Test2()
        {
            var bus = new InMemoryBus("a", true);
            bus.Subscribe(new AdHocHandler<StorageMessage.WriteCommit>(x => { }));
            bus.Subscribe(new AdHocHandler<Message>(x => { }));

            var msg = new StorageMessage.WriteCommit(Guid.NewGuid(), new NoopEnvelope(), 0);
            const int iterations = 1000000;

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < iterations; ++i)
            {
                bus.Handle(msg);
            }

            sw.Stop();

            Console.WriteLine("Elapsed: {0} ({1} per item).", sw.Elapsed, sw.ElapsedMilliseconds / (float)iterations);
        }
Exemple #5
0
        public void FSMSpeedTest2()
        {
            var bus = new InMemoryBus("a", true);

            bus.Subscribe(new AdHocHandler <StorageMessage.WriteCommit>(x => { }));
            bus.Subscribe(new AdHocHandler <Message>(x => { }));

            var       msg        = new StorageMessage.WriteCommit(Guid.NewGuid(), new NoopEnvelope(), 0);
            const int iterations = 1000000;

            var sw = Stopwatch.StartNew();

            for (int i = 0; i < iterations; ++i)
            {
                bus.Handle(msg);
            }

            sw.Stop();

            Console.WriteLine("Elapsed: {0} ({1} per item).", sw.Elapsed, sw.ElapsedMilliseconds / (float)iterations);
        }