Search in sources :

Example 1 with EntryEventSink

use of com.alibaba.otter.canal.sink.entry.EntryEventSink in project canal by alibaba.

the class CanalInstanceWithManager method initEventSink.

protected void initEventSink() {
    logger.info("init eventSink begin...");
    int groupSize = getGroupSize();
    if (groupSize <= 1) {
        eventSink = new EntryEventSink();
    } else {
        eventSink = new GroupEventSink(groupSize);
    }
    if (eventSink instanceof EntryEventSink) {
        ((EntryEventSink) eventSink).setFilterTransactionEntry(false);
        ((EntryEventSink) eventSink).setEventStore(getEventStore());
    }
    // if (StringUtils.isNotEmpty(filter)) {
    // AviaterRegexFilter aviaterFilter = new AviaterRegexFilter(filter);
    // ((AbstractCanalEventSink) eventSink).setFilter(aviaterFilter);
    // }
    logger.info("init eventSink end! \n\t load CanalEventSink:{}", eventSink.getClass().getName());
}
Also used : GroupEventSink(com.alibaba.otter.canal.sink.entry.group.GroupEventSink) EntryEventSink(com.alibaba.otter.canal.sink.entry.EntryEventSink)

Example 2 with EntryEventSink

use of com.alibaba.otter.canal.sink.entry.EntryEventSink in project canal by alibaba.

the class GroupEventPaserTest method buildEventParser.

private MysqlEventParser buildEventParser(int slaveId) {
    MysqlEventParser mysqlEventPaser = new MysqlEventParser();
    EntryPosition defaultPosition = buildPosition("mysql-bin.000001", 6163L, 1322803601000L);
    mysqlEventPaser.setDestination("group-" + slaveId);
    mysqlEventPaser.setSlaveId(slaveId);
    mysqlEventPaser.setDetectingEnable(false);
    mysqlEventPaser.setDetectingSQL(DETECTING_SQL);
    mysqlEventPaser.setMasterInfo(buildAuthentication());
    mysqlEventPaser.setMasterPosition(defaultPosition);
    mysqlEventPaser.setBinlogParser(buildParser(buildAuthentication()));
    mysqlEventPaser.setEventSink(new EntryEventSink());
    mysqlEventPaser.setLogPositionManager(new AbstractCanalLogPositionManager() {

        public void persistLogPosition(String destination, LogPosition logPosition) {
        // System.out.println(logPosition);
        }

        public LogPosition getLatestIndexBy(String destination) {
            return null;
        }
    });
    return mysqlEventPaser;
}
Also used : MysqlEventParser(com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser) EntryEventSink(com.alibaba.otter.canal.sink.entry.EntryEventSink) EntryPosition(com.alibaba.otter.canal.protocol.position.EntryPosition) AbstractCanalLogPositionManager(com.alibaba.otter.canal.parse.stub.AbstractCanalLogPositionManager) LogPosition(com.alibaba.otter.canal.protocol.position.LogPosition)

Aggregations

EntryEventSink (com.alibaba.otter.canal.sink.entry.EntryEventSink)2 MysqlEventParser (com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser)1 AbstractCanalLogPositionManager (com.alibaba.otter.canal.parse.stub.AbstractCanalLogPositionManager)1 EntryPosition (com.alibaba.otter.canal.protocol.position.EntryPosition)1 LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)1 GroupEventSink (com.alibaba.otter.canal.sink.entry.group.GroupEventSink)1