예제 #1
0
        public MsmqEndpointTargetBatchMigrator(ILogger logger, SqlConnection connection, string endpointName, string schema)
        {
            this.logger              = logger;
            this.schema              = schema;
            this.connection          = connection;
            databaseName             = connection.Database;
            endpointDelayedTableName = MsmqSqlConstants.DelayedTableName(endpointName);

            stagingDataTable = new DataTable();
            stagingDataTable.Columns.Add("Id");
            stagingDataTable.Columns.Add("Destination");
            stagingDataTable.Columns.Add("State", typeof(byte[]));
            stagingDataTable.Columns.Add("Time", typeof(DateTime));
            stagingDataTable.Columns.Add("Headers", typeof(byte[]));
        }
예제 #2
0
        public async ValueTask <MigrationCheckResult> AbleToMigrate(EndpointInfo endpoint)
        {
            var migrationCheckResult = new MigrationCheckResult();

            try
            {
                await EnsureConnectionOpen();
            }
            catch (Exception e)
            {
                migrationCheckResult.Problems.Add($"Unable to connect to the server or database using the provided connection string. Verify the connection string. The following exception occured: {e.Message}");
                return(migrationCheckResult);
            }

            var databaseName = connection.Database;

            try
            {
                await MsmqQueueCreator.CreateStagingQueue(connection, MsmqSqlConstants.TimeoutMigrationStagingTable, schema, databaseName, preview : true);
            }
            catch (Exception e)
            {
                migrationCheckResult.Problems.Add($"Attempt to verify whether the timeout migration staging table '{MsmqSqlConstants.TimeoutMigrationStagingTable}' could be created during migration mode failed. The following exception occured: {e.Message}");
            }

            var endpointDelayedTableName = MsmqSqlConstants.DelayedTableName(endpoint.EndpointName);

            if (!await MsmqQueueCreator
                .DoesDelayedDeliveryTableExist(connection, endpointDelayedTableName, schema, databaseName)
                .ConfigureAwait(false))
            {
                migrationCheckResult.Problems.Add($"Could not find delayed queue table with name '{endpointDelayedTableName}' for the endpoint '{endpoint.EndpointName}'");
            }

            return(migrationCheckResult);
        }