Ejemplo n.º 1
0
        public void PostMessage(IKey destination, IPacketProvider message)
        {
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }

            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            byte[] messageBytes = message.GetBytes();
            _log.Debug($"Enqueuing to single destination {destination.Value.ToHexString()} message {messageBytes.ToHexString()}");
            _messagesQueue.Add(new KeyValuePair <IKey, byte[]>(destination, messageBytes));
        }
Ejemplo n.º 2
0
        public void PostMessage(IEnumerable <IKey> destinations, IPacketProvider message)
        {
            if (destinations == null)
            {
                throw new ArgumentNullException(nameof(destinations));
            }

            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            foreach (IKey destination in destinations)
            {
                byte[] messageBytes = message.GetBytes();
                _log.Debug($"Enqueuing to one of multiple destinations {destination.Value.ToHexString()} message {messageBytes.ToHexString()}");
                _messagesQueue.Add(new KeyValuePair <IKey, byte[]>(destination, messageBytes));
            }
        }