Esempio n. 1
0
        private void SendTransportMessage(MessageId?messageId, IMessage message, IList <Peer> peers, bool logEnabled, bool locallyHandled = false)
        {
            if (peers.Count == 0)
            {
                if (!locallyHandled && logEnabled)
                {
                    _messageLogger.InfoFormat("SEND: {0} with no target peer", message);
                }

                return;
            }

            var transportMessage = ToTransportMessage(message);

            if (messageId != null)
            {
                transportMessage.Id = messageId.Value;
            }

            if (logEnabled)
            {
                LogMessageSend(message, transportMessage, peers);
            }

            SendTransportMessage(transportMessage, peers);
        }
Esempio n. 2
0
        protected virtual void HandleRemoteMessage(TransportMessage transportMessage, bool synchronous = false)
        {
            var dispatch = CreateMessageDispatch(transportMessage, synchronous);

            if (dispatch == null)
            {
                return;
            }

            _messageLogger.InfoFormat("RECV remote: {0} from {3} ({2} bytes). [{1}]", dispatch.Message, transportMessage.Id, transportMessage.MessageBytes.Length, transportMessage.Originator.SenderId);
            _messageDispatcher.Dispatch(dispatch);
        }
Esempio n. 3
0
File: Bus.cs Progetto: Bourl/Zebus
        private void SendTransportMessage(MessageId?messageId, IMessage message, IList <Peer> peers, bool logEnabled, bool locallyHandled = false)
        {
            if (peers.Count == 0)
            {
                if (!locallyHandled && logEnabled)
                {
                    _messageLogger.InfoFormat("SEND: {0} with no target peer", message);
                }

                return;
            }

            var transportMessage = ToTransportMessage(message, messageId ?? MessageId.NextId());

            if (logEnabled)
            {
                _messageLogger.InfoFormat("SEND: {0} to {3} ({2} bytes) [{1}]", message, transportMessage.Id, transportMessage.MessageBytes.Length, peers);
            }

            SendTransportMessage(transportMessage, peers);
        }