Apache ShardingSphere v5.5.0 document
streamingId) v o i d Stop subscription dropStreaming(String streamingId) v o i d Delete subscription await() v o i d Block the CDC thread and wait for the channel to close close() v o i d Close the channel true)); log.info("Streaming id={}", streamingId); // Prevent the main thread from exiting cdcClient.await(); } } } There are mainly 4 steps 1. Construct CDCClient, pass in CDCClientConfiguration 2. Call database and table exist in ShardingSphere‐Proxy, otherwise an error will be reported CDCClient.await is to block the main thread, it is not a necessary step, other methods can also be used, as long0 码力 | 602 页 | 3.85 MB | 1 年前3Apache ShardingSphere v5.5.0 中文文档
stopStreaming(String streamingId) v o i d 停止订阅 dropStreaming(String streamingId) v o i d 删除订阅 await() v o i d 阻塞 CDC 线程,等待 channel 关闭 close() v o i d 关闭 channel,流程结束 使用手册 CDC 功能介绍 CDC 只会同步数据,不会同步表结构,目前也不支持 streamingId); 9.2. ShardingSphere-Proxy 405 Apache ShardingSphere document // 防止 main 主线程退出 cdcClient.await(); } } } 主要有 4 个步骤 1. 构造 CDCClient,传入 CDCClientConfiguration 2. 调用 CDCClient.connect,这一步 是和 CDC 中配置好的用户名和密码登录 4. 调用 CDCClient.startStreaming,开启订阅,需要保证订阅的库和表在 ShardingSphere‐Proxy 存在,否 则会报错。 CDCClient.await 是阻塞主线程,非必需的步骤,用其他方式也可以,只要保证 CDC 线程一直 在工作就行。 如果需要更复杂数据消费的实现,例如写入到数据库,可以参考 DataSourceRecordConsumer0 码力 | 557 页 | 4.61 MB | 1 年前3
共 2 条
- 1