示例#1
0
        public void Dispatch(MessageDispatch dispatch)
        {
            var queue   = GetQueue(dispatch.Message.GetType());
            var invoker = GetInvoker(dispatch.Message.GetType());

            queue.RunOrEnqueue(dispatch, invoker);
        }
示例#2
0
文件: Bus.cs 项目: thomasraynal/busy
        public void Start()
        {
            Self = new Peer(PeerId, EndPoint);

            _directory.Configure(this);

            _transport = _container.GetInstance <ITransport>();
            _transport.Configure(PeerId, EndPoint);

            _transport.Start();

            _transport.MessageReceived += (transportMessage) =>
            {
                var message = ToMessage(transportMessage);
                var dispach = new MessageDispatch(message);
                _messageDispatcher.Dispatch(dispach);
            };

            PerformAutoSubscribe();

            Task.Delay(1000).Wait();
        }