Пример #1
0
        protected override async Task Publish(string messageId, Guid attemptId,
                                              IEnumerable <OutgoingMessageRecord> committedSideEffects,
                                              IEnumerable <OutgoingMessageRecord> abortedSideEffects)
        {
            var operations = committedSideEffects.Select(r => r.ToTransportOperation()).ToArray();

            if (log.IsDebugEnabled)
            {
                log.Debug($"Dispatching messages {string.Join(",", operations.Select(o => o.Message.MessageId))} generated by attempt {attemptId} of transaction {messageId}.");
            }

            await dispatcher.Dispatch(new TransportOperations(operations), new TransportTransaction(), new ContextBag())
            .ConfigureAwait(false);

            var abortedIds = abortedSideEffects.Select(r => r.Id).ToArray();

            if (log.IsDebugEnabled)
            {
                log.Debug($"Removing tokens for aborted message send attempts {string.Join(", ", abortedIds)}");
            }
            await messageStore.EnsureDeleted(abortedIds)
            .ConfigureAwait(false);

            if (log.IsDebugEnabled)
            {
                log.Debug($"Removing token for successfully processed message {messageId}.");
            }
            await messageStore.Delete(messageId).ConfigureAwait(false);
        }
 public Task EnsureDeleted(string[] messageIds)
 {
     return(impl.EnsureDeleted(messageIds));
 }