public async Task StartExportingChangesAsync(CancellationToken token,
                                                     string executionId,
                                                     List <string> tables,
                                                     TimeSpan interval,
                                                     int perTableBufferLimit,
                                                     int transactionBufferLimit,
                                                     int transactionBatchSizeLimit)
        {
            await _redshiftClient.CacheTableColumnsAsync(tables);

            _exporterTask = Task.Run(async() =>
            {
                while (!token.IsCancellationRequested)
                {
                    try
                    {
                        await StartExportingAsync(token,
                                                  executionId,
                                                  tables,
                                                  interval,
                                                  perTableBufferLimit,
                                                  transactionBufferLimit,
                                                  transactionBatchSizeLimit);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Transaction reader failure. Will restart in 30 seconds. Error: {ex}");
                        await WaitForSeconds(token, 30);
                    }
                }
            });
        }
        public async Task StartExportingChangesAsync(CancellationToken token, string executionId, List <string> tables, TimeSpan interval, int batchSize)
        {
            await _redshiftClient.CacheTableColumnsAsync(tables);

            foreach (var tableName in tables)
            {
                var readerTask = Task.Run(async() =>
                {
                    while (!token.IsCancellationRequested)
                    {
                        try
                        {
                            await StartPublishingChanges(token,
                                                         executionId,
                                                         tableName,
                                                         interval,
                                                         batchSize);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine($"CDC reader failure. Table {tableName}. Will restart in 30 seconds. Error: {ex}");
                            await WaitForSeconds(token, 30);
                        }
                    }
                });
                _readerTasks.Add(readerTask);
            }
        }
        public async Task ExportTablesAsync(CancellationToken token,
                                            string executionId,
                                            List <string> tables,
                                            int batchSize,
                                            int printMod)
        {
            await _redshiftClient.CacheTableColumnsAsync(tables);

            foreach (var tableName in tables)
            {
                var tableSchema = await _cdcReaderClient.GetTableSchemaAsync(tableName);

                _loadTasks.Add(Task.Run(async() =>
                {
                    try
                    {
                        await ExportTableAsync(token,
                                               executionId,
                                               tableSchema,
                                               batchSize,
                                               printMod);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }));
            }
        }
Exemple #4
0
 public async Task CacheTableColumnsAsync(List <string> tables)
 {
     await _redshiftClient.CacheTableColumnsAsync(tables);
 }