Пример #1
0
        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            var networkToUse = context.GetOrAdd(CurrentNetworkConnectionKey, () => _network);

            if (!networkToUse.HasQueue(destinationAddress))
            {
                throw new ArgumentException($"Destination queue address '{destinationAddress}' does not exist!");
            }

            context.OnCommitted(async _ => networkToUse.Deliver(destinationAddress, message.ToInMemTransportMessage()));
        }
Пример #2
0
        /// <summary>
        /// Delivers the given message to the queue identitied by the given <paramref name="destinationAddress"/>
        /// </summary>
        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            if (destinationAddress == null)
            {
                throw new ArgumentNullException("destinationAddress");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (!_network.HasQueue(destinationAddress))
            {
                throw new ArgumentException(string.Format("Destination queue address '{0}' does not exist!", destinationAddress));
            }

            context.OnCommitted(async() => _network.Deliver(destinationAddress, message.ToInMemTransportMessage()));
        }