package com.zhangmeng.canal.listener;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.*;

/**
 * @author 转身的背影在心底里沉沦
 * @version 1.0
 * @date 2021/9/13 0:05
 */
@CanalEventListener
public class CanalDataEventListener {

    /***
     * 自定义数据修改监听  @ListenPoint @InsertListenPoint @UpdateListenPoint  @DeleteListenPoint
     * @param eventType
     * @param rowData
     */
    @ListenPoint(destination = "example", schema = "mystyle-blog")
    public void onEventCustomUpdate(CanalEntry.EventType eventType, CanalEntry.RowData rowData) {
        System.err.println(CanalEntry.EventType.valueOf(eventType.getNumber()));
        rowData.getAfterColumnsList().forEach((c) -> System.out.println("row: " + c.getName() + " ::   " + c.getValue()));
    }
}
