示例#1
0
    async Task DispatchWithTrackerIdentifier(Func <Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext, string messageId, string secondLevelMessageId = null)
    {
        try
        {
            await next();

            await transactionContext.Commit();

            _errorTracker.CleanUp(messageId);

            if (secondLevelMessageId != null)
            {
                _errorTracker.CleanUp(secondLevelMessageId);
            }
        }
        catch (OperationCanceledException) when(_cancellationToken.IsCancellationRequested)
        {
            // we're exiting, so we abort like this:
            _logger.Info("Dispatch of message with ID {messageId} was cancelled", messageId);

            transactionContext.Abort();
        }
        catch (Exception exception)
        {
            _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

            transactionContext.Abort();
        }
    }
示例#2
0
        async Task _handle(IncomingStepContext context, Func <Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext, string messageId, string secondLevelMessageId = null)
        {
            try
            {
                await next();

                await transactionContext.Commit();

                _errorTracker.CleanUp(messageId);

                if (secondLevelMessageId != null)
                {
                    _errorTracker.CleanUp(secondLevelMessageId);
                }
            }
            catch (OperationCanceledException) when(_cancellationToken.IsCancellationRequested)
            {
                _logger.Info("Dispatch of message with ID {messageId} was cancelled", messageId);

                transactionContext.Abort();
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);
                _checkFinal(context);

                await _handleError(context, next, identifierToTrackMessageBy);
            }
        }
        async Task DispatchWithTrackerIdentifier(Func <Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext)
        {
            try
            {
                await next();
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

                transactionContext.Abort();
            }
        }
示例#4
0
        async Task DispatchWithTrackerIdentifier(Func <Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext, string[] identifiersToClearOnSuccess)
        {
            try
            {
                await next();

                await transactionContext.Commit();

                foreach (var id in identifiersToClearOnSuccess)
                {
                    _errorTracker.CleanUp(id);
                }
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

                transactionContext.Abort();
            }
        }
        async Task DispatchWithTrackerIdentifier(Func <Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext, string messageId, string secondLevelMessageId = null)
        {
            try
            {
                await next().ConfigureAwait(false);

                await transactionContext.Commit().ConfigureAwait(false);

                _errorTracker.CleanUp(messageId);

                if (secondLevelMessageId != null)
                {
                    _errorTracker.CleanUp(secondLevelMessageId);
                }
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

                transactionContext.Abort();
            }
        }
        async Task DispatchWithTrackerIdentifier(Func<Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext, string[] identifiersToClearOnSuccess)
        {
            try
            {
                await next();

                await transactionContext.Commit();

                foreach (var id in identifiersToClearOnSuccess)
                {
                    _errorTracker.CleanUp(id);
                }
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

                transactionContext.Abort();
            }
        }
示例#7
0
        async Task DispatchWithTrackerIdentifier(Func<Task> next, string identifierToTrackMessageBy, ITransactionContext transactionContext)
        {
            try
            {
                await next();

                await transactionContext.Commit();
            }
            catch (Exception exception)
            {
                _errorTracker.RegisterError(identifierToTrackMessageBy, exception);

                transactionContext.Abort();
            }
        }