Beispiel #1
0
        public async Task Publish(Envelope envelope)
        {
            if (envelope.Message == null)
            {
                throw new ArgumentNullException(nameof(envelope.Message));
            }
            if (envelope.RequiresLocalReply)
            {
                throw new ArgumentOutOfRangeException(nameof(envelope), "Cannot 'Publish' and envelope that requires a local reply");
            }

            var outgoing = await _router.Route(envelope);

            trackEnvelopeCorrelation(outgoing);

            if (!outgoing.Any())
            {
                _logger.NoRoutesFor(envelope);
                return;
            }

            await persistOrSend(outgoing);
        }