Search in sources :

Example 26 with Event

use of com.alibaba.otter.canal.store.model.Event in project canal by alibaba.

the class MemoryEventStoreBase method buildEvent.

protected Event buildEvent(String binlogFile, long offset, long timestamp) {
    Header.Builder headerBuilder = Header.newBuilder();
    headerBuilder.setLogfileName(binlogFile);
    headerBuilder.setLogfileOffset(offset);
    headerBuilder.setExecuteTime(timestamp);
    headerBuilder.setEventLength(1024);
    Entry.Builder entryBuilder = Entry.newBuilder();
    entryBuilder.setHeader(headerBuilder.build());
    Entry entry = entryBuilder.build();
    return new Event(new LogIdentity(new InetSocketAddress(MYSQL_ADDRESS, 3306), 1234L), entry);
}
Also used : Entry(com.alibaba.otter.canal.protocol.CanalEntry.Entry) Header(com.alibaba.otter.canal.protocol.CanalEntry.Header) InetSocketAddress(java.net.InetSocketAddress) Event(com.alibaba.otter.canal.store.model.Event) LogIdentity(com.alibaba.otter.canal.protocol.position.LogIdentity)

Aggregations

Event (com.alibaba.otter.canal.store.model.Event)26 Position (com.alibaba.otter.canal.protocol.position.Position)12 MemoryEventStoreWithBuffer (com.alibaba.otter.canal.store.memory.MemoryEventStoreWithBuffer)10 Test (org.junit.Test)10 Entry (com.alibaba.otter.canal.protocol.CanalEntry.Entry)5 ArrayList (java.util.ArrayList)5 CanalEntry (com.alibaba.otter.canal.protocol.CanalEntry)4 Date (java.util.Date)4 LogIdentity (com.alibaba.otter.canal.protocol.position.LogIdentity)3 LogPosition (com.alibaba.otter.canal.protocol.position.LogPosition)3 CanalStoreException (com.alibaba.otter.canal.store.CanalStoreException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ReentrantLock (java.util.concurrent.locks.ReentrantLock)3 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)2 Header (com.alibaba.otter.canal.protocol.CanalEntry.Header)2 Message (com.alibaba.otter.canal.protocol.Message)2 ExecutorService (java.util.concurrent.ExecutorService)2 RowChange (com.alibaba.otter.canal.protocol.CanalEntry.RowChange)1 RowData (com.alibaba.otter.canal.protocol.CanalEntry.RowData)1 PositionRange (com.alibaba.otter.canal.protocol.position.PositionRange)1