コード例 #1
0
        protected override async Task PerformPublishAsync(
            IEnumerable <DomainEvent> events,
            CancellationToken?cancellationToken = default)
        {
            var unit = new AtomicUnit(events);

            await PerformPersistAsync(unit, cancellationToken : cancellationToken)
            .ConfigureAwait(false);
        }
コード例 #2
0
        private async Task PerformPersistAsync(
            AtomicUnit unit,
            CancellationToken?cancellationToken = default)
        {
            try
            {
                _ = await store
                    .CreateAsync(unit, cancellationToken : cancellationToken)
                    .ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                await
                OnDiagnosticsEmittedAsync(
                    Level.Error,
                    cancellationToken : cancellationToken,
                    cause : ex,
                    message : Format(PersistentBusPublishFailure, unit.Id))
                .ConfigureAwait(false);

                throw;
            }
        }