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); }
/// <summary> /// if message is acked we can safely delete it /// </summary> /// <param name="messageId">identifier of the message</param> private void OnMessageAck(Guid messageId) { _logger.LogInformation($"Received ack for message with id: {messageId} in topic: {Name}"); _messageStore.Delete(messageId); }
public Task Delete(string messageId) { return(impl.Delete(messageId)); }