示例#1
0
        public Task Run()
        {
            _mainApplicationTask = new TaskCompletionSource <bool>();

            // System recorder
            var systemRecorder = new SystemRecorder();

            _systemMessageDispatcher = systemRecorder;
            _systemMessageDispatcher.InterruptedWithMessage += SystemInterruptedHandler;

            // Application recorder
            _applicationRecorder = new ApplicationRecorder(systemRecorder, new MessagesCache(10));

            // Remote trace monitor
            var remoteTraceMonitor = new RemoteTraceMonitor(new ConsoleAbstraction()
                                                            , 4,
                                                            systemRecorder,
                                                            systemRecorder);

            remoteTraceMonitor.Start();

            var remoteTraceMonitorСonsistent = new RemoteTraceMonitorСonsistent(remoteTraceMonitor);

            var remoteOperatorFactory        = new BaseMonitoredRemoteOperatorFactory(new BaseInstructionSenderFactory(_applicationRecorder), remoteTraceMonitorСonsistent, _applicationRecorder);
            var traceableRemoteApiMapFactory = new BaseTraceableRemoteApiMapFactory(new BaseInstructionReceiverFactory(_applicationRecorder), _applicationRecorder);

            var apiOperatorFactory = new ApiOperatorFactory(remoteOperatorFactory, traceableRemoteApiMapFactory, _applicationRecorder);

            apiOperatorFactory.Create("127.0.0.1:8081");

            return(_mainApplicationTask.Task);
        }
示例#2
0
        public Task Run()
        {
            _mainApplicationTask = new TaskCompletionSource <bool>();

            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            // System recorder
            var systemRecorder = new SystemRecorder();

            _systemMessageDispatcher = systemRecorder;
            _systemMessageDispatcher.InterruptedWithMessage += SystemInterruptedHandler;

            // Application recorder
            _applicationRecorder = new ApplicationRecorder(systemRecorder,
                                                           new MessagesCache(Int32.Parse(configuration["MESSAGE_CACHE"])));

            // Remote trace monitor
            var remoteTraceMonitor = new RemoteTraceMonitor(new ConsoleAbstraction()
                                                            , Int32.Parse(configuration["MONITOR_LINES"]),
                                                            bool.Parse(configuration["SHOW_DEBUG_MESSAGES"]),
                                                            systemRecorder,
                                                            systemRecorder);

            remoteTraceMonitor.Start();
            var remoteTraceMonitorСonsistent = new RemoteTraceMonitorСonsistent(remoteTraceMonitor);

            var remoteOperatorFactory        = new BaseMonitoredRemoteOperatorFactory(new BaseInstructionSenderFactory(_applicationRecorder), remoteTraceMonitorСonsistent, _applicationRecorder, _applicationRecorder);
            var traceableRemoteApiMapFactory = new BaseTraceableRemoteApiMapFactory(new BaseInstructionReceiverFactory(_applicationRecorder), _applicationRecorder);

            var apiOperatorFactory = new ApiOperatorFactory(remoteOperatorFactory, traceableRemoteApiMapFactory, _applicationRecorder);

            apiOperatorFactory.Create(configuration["IP_ADDRESS"]);

            return(_mainApplicationTask.Task);
        }