Is there any way to restart the Debezium connector automatically in Apache Camel?

Viewed 244

I am using Debezium Sql Server Connector for Apache Camel to replicate changes from one database to another.

@Configuration
class DebeziumRoute extends RouteBuilder {
    @Override
    public void configure() {
        from("debezium-sqlserver:iwdcamel" +
                "?databaseServerName=iwdcamel" +
                "&databaseHostname=localhost" +
                "&databasePort=1433" +
                "&databaseDbname=MyDB" +
                "&databaseUser=sa" +
                "&databasePassword=MyPassword" +
                "&tableWhitelist=dbo.MyTable" +
                "&offsetStorageFileName=./offset-file.dat" +
                "&databaseHistoryFileFilename=./history-file.dat")
            .choice()
                ...
            .end();
    }
}

Everything works fine, except that when for some reason the database or network goes down, the connector stop and won't start again, even if the database recovers in a few seconds.

io.debezium.embedded.EmbeddedEngine: Error while trying to run connector class 'io.debezium.connector.sqlserver.SqlServerConnector'

org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.

com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server no devolvió una respuesta. Se ha cerrado la conexión.

Is there any way to restart the Debezium connector automatically?, or at least...

Is there any way to check the status of connector periodically and restart if needed?

Any idea is welcome...

0 Answers
Related