Exemple #1
0
        /// <summary>
        /// Routes an <see cref="OutboundBrokeredMessage"/> to the receiver via the message broker infrastructure.
        /// </summary>
        /// <param name="outboundBrokeredMessage">The outbound brokered message to be routed to the destination receiver</param>
        /// <param name="transactionContext">The contextual transaction information to be used while routing the message to its destination</param>
        /// <returns>An awaitable <see cref="Task"/></returns>
        public Task Route(OutboundBrokeredMessage outboundBrokeredMessage, TransactionContext transactionContext)
        {
            if (string.IsNullOrWhiteSpace(outboundBrokeredMessage.Destination))
            {
                throw new ArgumentNullException(nameof(outboundBrokeredMessage.Destination), $"Unable to route message with no destination path specified");
            }

            return(_brokeredMessageInfrastructureDispatcher.Dispatch(outboundBrokeredMessage, transactionContext));
        }
Exemple #2
0
        public async Task Process(OutboxMessage message)
        {
            var appProps = JsonConvert.DeserializeObject <IDictionary <string, object> >(message.StringifiedApplicationProperties);

            appProps.TryGetValue(ApplicationProperties.ContentType, out var contentType);

            var outbound = message.AsOutboundBrokeredMessage(appProps, _bodyConverterFactory.CreateBodyConverter((string)contentType));

            _logger.LogTrace($"Processing message '{message.MessageId}' from outbox.");

            await _brokeredMessageInfrastructureDispatcher.Dispatch(outbound, null);

            _logger.LogTrace($"Message '{message.MessageId}' dispatched to messaging infrastructure from outbox.");

            await _brokeredMessageOutbox.UpdateProcessedDate(message);
        }