Search in sources :

Example 6 with MysqlEventParser

use of com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser in project canal by alibaba.

the class GroupEventPaserTest method testMysqlWithMysql.

@Test
public void testMysqlWithMysql() {
    // MemoryEventStoreWithBuffer eventStore = new
    // MemoryEventStoreWithBuffer();
    // eventStore.setBufferSize(8196);
    GroupEventSink eventSink = new GroupEventSink(3);
    eventSink.setFilterTransactionEntry(false);
    eventSink.setEventStore(new DummyEventStore());
    eventSink.start();
    // 构造第一个mysql
    MysqlEventParser mysqlEventPaser1 = buildEventParser(3344);
    mysqlEventPaser1.setEventSink(eventSink);
    // 构造第二个mysql
    MysqlEventParser mysqlEventPaser2 = buildEventParser(3345);
    mysqlEventPaser2.setEventSink(eventSink);
    // 构造第二个mysql
    MysqlEventParser mysqlEventPaser3 = buildEventParser(3346);
    mysqlEventPaser3.setEventSink(eventSink);
    // 启动
    mysqlEventPaser1.start();
    mysqlEventPaser2.start();
    mysqlEventPaser3.start();
    try {
        Thread.sleep(30 * 10 * 1000L);
    } catch (InterruptedException e) {
    }
    mysqlEventPaser1.stop();
    mysqlEventPaser2.stop();
    mysqlEventPaser3.stop();
}
Also used : GroupEventSink(com.alibaba.otter.canal.sink.entry.group.GroupEventSink) MysqlEventParser(com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser) Test(org.junit.Test)

Aggregations

MysqlEventParser (com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser)6 CanalHAController (com.alibaba.otter.canal.parse.ha.CanalHAController)4 AbstractEventParser (com.alibaba.otter.canal.parse.inbound.AbstractEventParser)3 CanalException (com.alibaba.otter.canal.common.CanalException)2 CanalEventParser (com.alibaba.otter.canal.parse.CanalEventParser)2 CanalLogPositionManager (com.alibaba.otter.canal.parse.index.CanalLogPositionManager)2 AuthenticationInfo (com.alibaba.otter.canal.parse.support.AuthenticationInfo)2 EntryPosition (com.alibaba.otter.canal.protocol.position.EntryPosition)2 MediaHAController (com.alibaba.otter.canal.extend.ha.MediaHAController)1 AviaterRegexFilter (com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter)1 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)1 CanalInstanceGenerator (com.alibaba.otter.canal.instance.core.CanalInstanceGenerator)1 CanalInstanceWithManager (com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager)1 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)1 HAMode (com.alibaba.otter.canal.instance.manager.model.CanalParameter.HAMode)1 HeartBeatHAController (com.alibaba.otter.canal.parse.ha.HeartBeatHAController)1 LocalBinlogEventParser (com.alibaba.otter.canal.parse.inbound.mysql.LocalBinlogEventParser)1 AbstractCanalLogPositionManager (com.alibaba.otter.canal.parse.stub.AbstractCanalLogPositionManager)1 ClientIdentity (com.alibaba.otter.canal.protocol.ClientIdentity)1 LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)1