Java Code Examples for io.debezium.text.MultipleParsingExceptions

Following code examples demonstrate how to use io.debezium.text.MultipleParsingExceptions from debezium. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use io.debezium.text.MultipleParsingExceptions and various code implementation of this class.
Example 1
Project : debezium Source File : MySqlSchema.java View Source Code on GitHub

    
    public boolean applyDdl(SourceInfo source, String databaseName, String ddlStatements,
                            DatabaseStatementStringConsumer statementConsumer) {
        Set<TableId> changes;
        if (ignoredQueryStatements.contains(ddlStatements)) return false;
        try {
            this.ddlChanges.reset();
            this.ddlParser.setCurrentSchema(databaseName);
            this.ddlParser.parse(ddlStatements, tables());
        } catch (ParsingException | MultipleParsingExceptions e) {
            if (skipUnparseableDDL) {
                logger.warn("Ignoring unparseable DDL statement '{}': {}", ddlStatements);
            } else {
                throw e;
            }
        } finally {
            changes = tables().drainChanges();
            if (!storeOnlyMonitoredTablesDdl || !changes.isEmpty()) {
                if (statementConsumer != null) {


                    if (!ddlChanges.isEmpty() && ddlChanges.applyToMoreDatabasesThan(databaseName)) {

                        ddlChanges.groupStatementStringsByDatabase((dbName, ddl) -> {
                            if (filters.databaseFilter().test(dbName) || dbName == null || "".equals(dbName)) {
                                if (dbName == null) dbName = "";
                                statementConsumer.consume(dbName, ddlStatements);
                            }
                        });
                    } else if (filters.databaseFilter().test(databaseName) || databaseName == null || "".equals(databaseName)) {
                        if (databaseName == null) databaseName = "";
                        statementConsumer.consume(databaseName, ddlStatements);
                    }
                }

                try {
                    if (!storeOnlyMonitoredTablesDdl || changes.stream().anyMatch(filters().tableFilter()::test)) {
                        dbHistory.record(source.partition(), source.offset(), databaseName, ddlStatements);
                    } else {
                        logger.debug("Changes for DDL '{}' were filtered and not recorded in database history", ddlStatements);
                    }
                } catch (Throwable e) {
                    throw new ConnectException(
                            "Error recording the DDL statement(s) in the database history " + dbHistory + ": " + ddlStatements, e);
                }
            }
        }

        changes.forEach(tableId -> {
            Table table = tableFor(tableId);
                removeSchema(tableId);
            }
            else {
                buildAndRegisterSchema(table);
            }
        });