| | |
| | |
|
| | |
|
| | | import com.alibaba.otter.canal.protocol.CanalEntry;
|
| | | import com.duxinglangzi.canal.starter.annotation.CanalInsertListener;
|
| | | import com.duxinglangzi.canal.starter.annotation.CanalListener;
|
| | | import com.duxinglangzi.canal.starter.annotation.CanalUpdateListener;
|
| | | import com.duxinglangzi.canal.starter.annotation.EnableCanalListener;
|
| | | import com.duxinglangzi.canal.starter.mode.CanalMessage;
|
| | | import CanalInsertListener;
|
| | | import CanalListener;
|
| | | import CanalUpdateListener;
|
| | | import EnableCanalListener;
|
| | | import CanalMessage;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.stream.Collectors;
|
| | |
| | | /**
|
| | | * 必须在类上 使用 EnableCanalListener 注解才能开启 canal listener
|
| | | *
|
| | | * 目前 Listener 方法的参数必须为 com.duxinglangzi.canal.starter.mode.CanalMessage
|
| | | * 目前 Listener 方法的参数必须为 CanalMessage
|
| | | * 程序在启动过程中会做检查
|
| | | */
|
| | |
|
| | |
| | | CanalEntry.RowData rowData = message.getRowData();
|
| | |
|
| | |
|
| | | System.out.println(" >>>>>>>>>>>>>[当前数据库: "+message.getDataBaseName()+" ," +
|
| | | System.out.println(" >>>>>>>>>>>>>[当前数据库: " + message.getDataBaseName() + " ," +
|
| | | "数据库表名: " + message.getTableName() + " , " +
|
| | | "方法: " + method );
|
| | | "方法: " + method);
|
| | |
|
| | | if (eventType == CanalEntry.EventType.DELETE) {
|
| | | rowData.getBeforeColumnsList().stream().collect(Collectors.toList()).forEach(ele -> {
|