Search in sources :

Example 1 with Table

use of org.apache.rocketmq.mysql.schema.Table in project rocketmq-externals by apache.

the class EventProcessor method processTableMapEvent.

private void processTableMapEvent(Event event) {
    TableMapEventData data = event.getData();
    String dbName = data.getDatabase();
    String tableName = data.getTable();
    Long tableId = data.getTableId();
    Table table = schema.getTable(dbName, tableName);
    tableMap.put(tableId, table);
}
Also used : TableMapEventData(com.github.shyiko.mysql.binlog.event.TableMapEventData) Table(org.apache.rocketmq.mysql.schema.Table)

Example 2 with Table

use of org.apache.rocketmq.mysql.schema.Table in project rocketmq-externals by apache.

the class EventProcessor method addRow.

private void addRow(String type, Long tableId, Serializable[] row) {
    if (transaction == null) {
        transaction = new Transaction(config);
    }
    Table t = tableMap.get(tableId);
    if (t != null) {
        while (true) {
            if (transaction.addRow(type, t, row)) {
                break;
            } else {
                transaction.setNextBinlogPosition(replicator.getNextBinlogPosition());
                replicator.commit(transaction, false);
                transaction = new Transaction(config);
            }
        }
    }
}
Also used : Table(org.apache.rocketmq.mysql.schema.Table)

Aggregations

Table (org.apache.rocketmq.mysql.schema.Table)2 TableMapEventData (com.github.shyiko.mysql.binlog.event.TableMapEventData)1