All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xiaowu.behappy.canal.example.handler.DefaultEntryHandler Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package org.xiaowu.behappy.canal.example.handler;


import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.xiaowu.behappy.canal.client.annotation.CanalTable;
import org.xiaowu.behappy.canal.client.context.CanalContext;
import org.xiaowu.behappy.canal.client.handler.EntryHandler;

import java.util.Map;

/**
 * 所有表的变化都会这里的逻辑
 * @author 小五
 */
@CanalTable(value = "all")
@Component
@Slf4j
public class DefaultEntryHandler implements EntryHandler> {

    @Override
    public void insert(Map map) {
        log.info("增加 {}", map);
        String table = CanalContext.getModel().getTable();
        log.info("table {}", table);
    }

    @Override
    public void update(Map before, Map after) {
        log.info("修改 before {}", before);
        log.info("修改 after {}", after);
        String table = CanalContext.getModel().getTable();
        log.info("table {}", table);
    }

    @Override
    public void delete(Map map) {
        log.info("删除 {}", map);
        String table = CanalContext.getModel().getTable();
        log.info("table {}", table);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy