fixed issue #1019 , support canal embedded with Entry
This commit is contained in:
@@ -20,6 +20,7 @@ import com.alibaba.otter.canal.sink.CanalEventDownStreamHandler;
|
||||
import com.alibaba.otter.canal.sink.CanalEventSink;
|
||||
import com.alibaba.otter.canal.sink.exception.CanalSinkException;
|
||||
import com.alibaba.otter.canal.store.CanalEventStore;
|
||||
import com.alibaba.otter.canal.store.memory.MemoryEventStoreWithBuffer;
|
||||
import com.alibaba.otter.canal.store.model.Event;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,8 @@ public class EntryEventSink extends AbstractCanalEventSink<List<CanalEntry.Entry
|
||||
protected AtomicLong lastTransactionCount = new AtomicLong(0L);
|
||||
protected volatile long lastEmptyTransactionTimestamp = 0L;
|
||||
protected AtomicLong lastEmptyTransactionCount = new AtomicLong(0L);
|
||||
private AtomicLong eventsSinkBlockingTime = new AtomicLong(0L);
|
||||
protected AtomicLong eventsSinkBlockingTime = new AtomicLong(0L);
|
||||
protected boolean raw;
|
||||
|
||||
public EntryEventSink(){
|
||||
addHandler(new HeartBeatEntryEventHandler());
|
||||
@@ -52,6 +54,10 @@ public class EntryEventSink extends AbstractCanalEventSink<List<CanalEntry.Entry
|
||||
super.start();
|
||||
Assert.notNull(eventStore);
|
||||
|
||||
if (eventStore instanceof MemoryEventStoreWithBuffer) {
|
||||
this.raw = ((MemoryEventStoreWithBuffer) eventStore).isRaw();
|
||||
}
|
||||
|
||||
for (CanalEventDownStreamHandler handler : getHandlers()) {
|
||||
if (!handler.isStart()) {
|
||||
handler.start();
|
||||
@@ -104,7 +110,7 @@ public class EntryEventSink extends AbstractCanalEventSink<List<CanalEntry.Entry
|
||||
|
||||
hasRowData |= (entry.getEntryType() == EntryType.ROWDATA);
|
||||
hasHeartBeat |= (entry.getEntryType() == EntryType.HEARTBEAT);
|
||||
Event event = new Event(new LogIdentity(remoteAddress, -1L), entry);
|
||||
Event event = new Event(new LogIdentity(remoteAddress, -1L), entry, raw);
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user