コード例 #1
0
        public async Task Fill(TableBasedQueue queue, CancellationToken cancellationToken)
        {
            //Logger.DebugFormat("Starting a new expired message purge task for table {0}.", queue);

            var totalCreatedRowsCount = 0;

            try
            {
                using (var connection = await openConnection(queue).ConfigureAwait(false))
                {
                    var continueCreateing = true;

                    while (continueCreateing && !cancellationToken.IsCancellationRequested)
                    {
                        var createdRowsCount = await queue.FillBatchOfChangeTracingMessages(connection, FillBatchSize).ConfigureAwait(false);

                        totalCreatedRowsCount += createdRowsCount;
                        continueCreateing      = createdRowsCount == FillBatchSize;
                    }
                }

                //Logger.DebugFormat("{0} expired messages were successfully purged from table {1}", totalPurgedRowsCount, queue);
            }
            catch
            {
                //Logger.WarnFormat("Purging expired messages from table {0} failed after purging {1} messages.", queue, totalPurgedRowsCount);
                throw;
            }
        }
コード例 #2
0
 public async Task Init(SqlConnectionFactory sqlConnectionFactory, TableBasedQueue inputQueue, Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError)
 {
     this.inputQueue           = inputQueue;
     this.onMessage            = onMessage;
     this.onError              = onError;
     this.sqlConnectionFactory = sqlConnectionFactory;
     this.failureInfoStorage   = new FailureInfoStorage(10000);
 }