Skip to content

Commit 0bf00a4

Browse files
committed
update readme
1 parent 3b3ba65 commit 0bf00a4

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,31 @@ public class MySQLListener implements SQLExecuteListener {
125125
DBStreamContext.getInstance().addListener(new MySQLListener());
126126
```
127127

128-
### 5. 查看表或情况表缓存数据(可选)
128+
### 5. 通过设置DBTableSupportProvider订阅对那些表进行监听(可选)
129+
130+
```
131+
132+
import com.codingapi.dbstream.scanner.DbTable;
133+
134+
import java.util.Properties;
135+
136+
public class DefaultDBTableSupportProvider implements DBTableSupportProvider {
137+
138+
@Override
139+
public boolean support(Properties info, DbTable dbTable) {
140+
if (dbTable.hasColumns() && dbTable.hasPrimaryKeys()) {
141+
return true;
142+
}
143+
return false;
144+
}
145+
}
146+
147+
148+
```
149+
150+
根据表名等信息来决定是否进行数据事件解析。仅当返回true的才会进行事件推送。DefaultDBTableSupportProvider为默认的实现机制。
151+
152+
### 6. 查看表或情况表缓存数据(可选)
129153

130154
在项目启动以后,会在项目的根路径下创建dbstream文件夹,文件夹中存储的内容为数据库的表扫描缓存数据。
131155
文件夹的名称为jdbcKey的字段,文件夹下的内容为缓存的表结构信息,当表结构发生变化以后可以删除对应的文件进行更新。

0 commit comments

Comments
 (0)