Search in sources :

Example 26 with EntryPosition

use of com.alibaba.otter.canal.protocol.position.EntryPosition in project canal by alibaba.

the class CanalEventUtils method createPosition.

/**
     * 根据entry创建对应的Position对象
     */
public static LogPosition createPosition(Event event) {
    EntryPosition position = new EntryPosition();
    position.setJournalName(event.getEntry().getHeader().getLogfileName());
    position.setPosition(event.getEntry().getHeader().getLogfileOffset());
    position.setTimestamp(event.getEntry().getHeader().getExecuteTime());
    // add serverId at 2016-06-28
    position.setServerId(event.getEntry().getHeader().getServerId());
    LogPosition logPosition = new LogPosition();
    logPosition.setPostion(position);
    logPosition.setIdentity(event.getLogIdentity());
    return logPosition;
}
Also used : EntryPosition(com.alibaba.otter.canal.protocol.position.EntryPosition) LogPosition(com.alibaba.otter.canal.protocol.position.LogPosition)

Aggregations

EntryPosition (com.alibaba.otter.canal.protocol.position.EntryPosition)26 LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)19 InetSocketAddress (java.net.InetSocketAddress)12 AbstractCanalLogPositionManager (com.alibaba.otter.canal.parse.stub.AbstractCanalLogPositionManager)10 Entry (com.alibaba.otter.canal.protocol.CanalEntry.Entry)10 AbstractCanalEventSinkTest (com.alibaba.otter.canal.parse.stub.AbstractCanalEventSinkTest)9 CanalSinkException (com.alibaba.otter.canal.sink.exception.CanalSinkException)9 List (java.util.List)9 AtomicLong (java.util.concurrent.atomic.AtomicLong)9 Test (org.junit.Test)9 TimeoutChecker (com.alibaba.otter.canal.parse.helper.TimeoutChecker)7 LogIdentity (com.alibaba.otter.canal.protocol.position.LogIdentity)5 IOException (java.io.IOException)5 Date (java.util.Date)5 CanalParseException (com.alibaba.otter.canal.parse.exception.CanalParseException)4 AuthenticationInfo (com.alibaba.otter.canal.parse.support.AuthenticationInfo)3 CanalEntry (com.alibaba.otter.canal.protocol.CanalEntry)3 ResultSetPacket (com.alibaba.otter.canal.parse.driver.mysql.packets.server.ResultSetPacket)2 MysqlEventParser (com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser)2 EventType (com.alibaba.otter.canal.protocol.CanalEntry.EventType)2