Java Code Examples for com.github.shyiko.mysql.binlog.event.QueryEventData#getSql()
The following examples show how to use
com.github.shyiko.mysql.binlog.event.QueryEventData#getSql() .
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: EventProcessor.java From openmessaging-connect-odar with Apache License 2.0 | 5 votes |
private void processQueryEvent(Event event) { QueryEventData data = event.getData(); String sql = data.getSql(); if (createTablePattern.matcher(sql).find()) { schema.reset(); } }
Example 2
Source File: BinLogDDLEventHandler.java From kkbinlog with Apache License 2.0 | 5 votes |
@Override public void handle(Event event) { boolean ddleventEnable = Boolean.parseBoolean(System.getProperty(DDLEVENT_ENABLE_KEY,DDLEVENT_ENABLE)); if(ddleventEnable){ QueryEventData data = event.getData(); String sql = data.getSql(); if (sql.contains(SUBSCRIBE_SQL_EVENT)) { log.info("数据库:{}发生alter table事件", data.getDatabase()); String topic = System.getProperty(DEFAULT_TOPIC_KEY,DEFAULT_TOPIC); dataPublisher.pushToKafka(topic, data); } } updateBinaryLogStatus(event.getHeader()); }
Example 3
Source File: BinaryLogConsumer.java From datacollector with Apache License 2.0 | 4 votes |
@Override public void onEvent(Event event) { LOG.trace("Received event {}", event); EventType eventType = event.getHeader().getEventType(); currentBinLogFileName = client.getBinlogFilename(); switch (eventType) { case TABLE_MAP: handleTableMappingEvent((TableMapEventData) event.getData()); break; case PRE_GA_WRITE_ROWS: case WRITE_ROWS: case EXT_WRITE_ROWS: handleRowEvent(event, event.<WriteRowsEventData>getData().getTableId()); break; case PRE_GA_UPDATE_ROWS: case UPDATE_ROWS: case EXT_UPDATE_ROWS: handleRowEvent(event, event.<UpdateRowsEventData>getData().getTableId()); break; case PRE_GA_DELETE_ROWS: case DELETE_ROWS: case EXT_DELETE_ROWS: handleRowEvent(event, event.<DeleteRowsEventData>getData().getTableId()); break; case QUERY: QueryEventData queryEventData = event.getData(); String query = queryEventData.getSql(); if (isCommit(query)) { finishTx(); } else if (isSchemaChangeQuery(query)) { schemaRepository.evictAll(); } break; case XID: finishTx(); break; case GTID: GtidEventData eventData = event.getData(); currentGtidSet = client.getGtidSet(); currentTxGtid = eventData.getGtid(); currentTxEventSeqNo = 0; LOG.trace("Started new tx, gtid: {}", currentTxGtid); break; default: // ignore break; } }
Example 4
Source File: BinaryLogConsumer.java From datacollector with Apache License 2.0 | 4 votes |
@Override public void onEvent(Event event) { LOG.trace("Received event {}", event); EventType eventType = event.getHeader().getEventType(); currentBinLogFileName = client.getBinlogFilename(); switch (eventType) { case TABLE_MAP: handleTableMappingEvent((TableMapEventData) event.getData()); break; case PRE_GA_WRITE_ROWS: case WRITE_ROWS: case EXT_WRITE_ROWS: handleRowEvent(event, event.<WriteRowsEventData>getData().getTableId()); break; case PRE_GA_UPDATE_ROWS: case UPDATE_ROWS: case EXT_UPDATE_ROWS: handleRowEvent(event, event.<UpdateRowsEventData>getData().getTableId()); break; case PRE_GA_DELETE_ROWS: case DELETE_ROWS: case EXT_DELETE_ROWS: handleRowEvent(event, event.<DeleteRowsEventData>getData().getTableId()); break; case QUERY: QueryEventData queryEventData = event.getData(); String query = queryEventData.getSql(); if (isCommit(query)) { finishTx(); } else if (isSchemaChangeQuery(query)) { schemaRepository.evictAll(); } break; case XID: finishTx(); break; case GTID: GtidEventData eventData = event.getData(); currentGtidSet = client.getGtidSet(); currentTxGtid = eventData.getGtid(); currentTxEventSeqNo = 0; LOG.trace("Started new tx, gtid: {}", currentTxGtid); break; default: // ignore break; } }