internal static IDomainExceptionMessage WithNotifyingContext(this IDomainExceptionMessage exception, IDomainNotification notification) { exception.ApplicationCommandId = notification.ApplicationCommandId; exception.ApplicationCommandType = notification.ApplicationCommandType; exception.ApplicationCommandReplyScheme = notification.ApplicationCommandReplyScheme; return(exception); }
internal static IDomainExceptionMessage WithEventingContext(this IDomainExceptionMessage exception, IDomainEvent @event) { exception.ApplicationCommandId = @event.ApplicationCommandId; exception.ApplicationCommandType = @event.ApplicationCommandType; exception.ApplicationCommandReplyScheme = @event.ApplicationCommandReplyScheme; return(exception); }
public async Task PublishAsync(IDomainExceptionMessage exception, CancellationToken token = default) { if (exception == null) { throw new ArgumentNullException(nameof(exception)); } exception.Topic = _options.Topic; await _messagePublisher.PublishAsync(exception, token); }
public void Publish(IDomainExceptionMessage exception) { if (exception == null) { throw new ArgumentNullException(nameof(exception)); } exception.Topic = _options.Topic; _messagePublisher.Publish(exception); }
private async Task PublishDomainExceptionAsync(IDomainExceptionMessage exception, CancellationToken token) { var publisher = _serviceProvider.GetService <IDomainExceptionMessagePublisher>(); try { await publisher.PublishAsync(exception, token); } catch (Exception e) { _logger.LogError($"Publishing domain exception has a exception: {LogFormatter.PrintException(e)}."); } }
public static IDomainExceptionMessage FillFrom(this IDomainExceptionMessage exception, IDomainCommand command) { exception.AggregateRootType = command.AggregateRootType.FullName; exception.AggregateRootId = command.AggregateRootId; exception.DomainCommandId = command.Id; exception.DomainCommandType = command.GetType().FullName; exception.Topic = command.Topic; exception.PartitionKey = command.PartitionKey; exception.ApplicationCommandId = command.ApplicationCommandId; exception.ApplicationCommandType = command.ApplicationCommandType; exception.ApplicationCommandReplyScheme = command.ApplicationCommandReplyScheme; return(exception); }
public async Task PublishDomainExceptionMessageAsync(IDomainExceptionMessage exception, CancellationToken token = default) { exception.WithNotifyingContext(_domainNotification); await _domainExceptionMessagePublisher.PublishAsync(exception, token); }
public void PublishDomainExceptionMessage(IDomainExceptionMessage exception) { exception.WithNotifyingContext(_domainNotification); _domainExceptionMessagePublisher.Publish(exception); }
public void PublishDomainExceptionMessage(IDomainExceptionMessage exception) { exception.WithEventingContext(_domainEvent); _domainExceptionMessagePublisher.Publish(exception); }