有什么方法可以在Apache Camel中自动重新启动Debezium连接器?

发布于 2025-01-22 14:36:10 字数 1548 浏览 1 评论 0原文

我正在使用 debezium sql sql sql sql serve camel camel for apache camel 从一个数据库更改为另一个数据库。

@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();
    }
}

一切正常,除了出于某种原因数据库或网络下降时,连接器停止并且即使数据库在几秒钟内恢复也不会重新启动。

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.

有什么方法可以自动重新启动 debezium 连接器?,至少...

有什么方法可以定期检查连接器的状态并在需要时重新启动?

欢迎任何想法...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文