Java Code Examples for com.alibaba.otter.canal.protocol.CanalEntry.EntryType#ROWDATA
The following examples show how to use
com.alibaba.otter.canal.protocol.CanalEntry.EntryType#ROWDATA .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntryEventSink.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
protected boolean doFilter(CanalEntry.Entry entry) { if (filter != null && entry.getEntryType() == EntryType.ROWDATA) { String name = getSchemaNameAndTableName(entry); boolean need = filter.filter(name); if (!need) { logger.debug("filter name[{}] entry : {}:{}", name, entry.getHeader().getLogfileName(), entry.getHeader().getLogfileOffset()); } return need; } else { return true; } }
Example 2
Source File: EntryEventSink.java From canal with Apache License 2.0 | 6 votes |
protected boolean doFilter(CanalEntry.Entry entry) { if (filter != null && entry.getEntryType() == EntryType.ROWDATA) { String name = getSchemaNameAndTableName(entry); boolean need = filter.filter(name); if (!need) { logger.debug("filter name[{}] entry : {}:{}", name, entry.getHeader().getLogfileName(), entry.getHeader().getLogfileOffset()); } return need; } else { return true; } }
Example 3
Source File: Event.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public Event(LogIdentity logIdentity, CanalEntry.Entry entry, boolean raw){ this.logIdentity = logIdentity; this.entryType = entry.getEntryType(); this.executeTime = entry.getHeader().getExecuteTime(); this.journalName = entry.getHeader().getLogfileName(); this.position = entry.getHeader().getLogfileOffset(); this.serverId = entry.getHeader().getServerId(); this.gtid = entry.getHeader().getGtid(); this.eventType = entry.getHeader().getEventType(); if (entryType == EntryType.ROWDATA) { List<CanalEntry.Pair> props = entry.getHeader().getPropsList(); if (props != null) { for (CanalEntry.Pair p : props) { if ("rowsCount".equals(p.getKey())) { rowsCount = Integer.parseInt(p.getValue()); break; } } } } if (raw) { // build raw this.rawEntry = entry.toByteString(); this.rawLength = rawEntry.size(); } else { this.entry = entry; // 按照6倍的event length预估 this.rawLength = entry.getHeader().getEventLength() * 6; } }
Example 4
Source File: Event.java From canal with Apache License 2.0 | 5 votes |
public Event(LogIdentity logIdentity, CanalEntry.Entry entry, boolean raw){ this.logIdentity = logIdentity; this.entryType = entry.getEntryType(); this.executeTime = entry.getHeader().getExecuteTime(); this.journalName = entry.getHeader().getLogfileName(); this.position = entry.getHeader().getLogfileOffset(); this.serverId = entry.getHeader().getServerId(); this.gtid = entry.getHeader().getGtid(); this.eventType = entry.getHeader().getEventType(); if (entryType == EntryType.ROWDATA) { List<CanalEntry.Pair> props = entry.getHeader().getPropsList(); if (props != null) { for (CanalEntry.Pair p : props) { if ("rowsCount".equals(p.getKey())) { rowsCount = Integer.parseInt(p.getValue()); break; } } } } if (raw) { // build raw this.rawEntry = entry.toByteString(); this.rawLength = rawEntry.size(); } else { this.entry = entry; // 按照6倍的event length预估 this.rawLength = entry.getHeader().getEventLength() * 6; } }