Java Code Examples for io.debezium.config.Configuration#subset()

The following examples show how to use io.debezium.config.Configuration#subset() . 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: TestHelper.java    From debezium-incubator with Apache License 2.0 6 votes vote down vote up
public static OracleConnection testConnection() {
    Configuration config = testConfig().build();
    Configuration jdbcConfig = config.subset("database.", true);

    OracleConnection jdbcConnection = new OracleConnection(jdbcConfig, new OracleConnectionFactory());
    try {
        jdbcConnection.setAutoCommit(false);
    }
    catch (SQLException e) {
        throw new RuntimeException(e);
    }

    String pdbName = new OracleConnectorConfig(config).getPdbName();

    if (pdbName != null) {
        jdbcConnection.setSessionToPdb(pdbName);
    }

    return jdbcConnection;
}
 
Example 2
Source File: TestHelper.java    From debezium-incubator with Apache License 2.0 6 votes vote down vote up
public static OracleConnection adminConnection() {
    Configuration config = adminConfig().build();
    Configuration jdbcConfig = config.subset("database.", true);

    OracleConnection jdbcConnection = new OracleConnection(jdbcConfig, new OracleConnectionFactory());
    try {
        jdbcConnection.setAutoCommit(false);
    }
    catch (SQLException e) {
        throw new RuntimeException(e);
    }

    String pdbName = new OracleConnectorConfig(config).getPdbName();

    if (pdbName != null) {
        jdbcConnection.setSessionToPdb(pdbName);
    }

    return jdbcConnection;
}
 
Example 3
Source File: TestHelper.java    From debezium-incubator with Apache License 2.0 5 votes vote down vote up
public static OracleConnection defaultConnection() {
    Configuration config = defaultConfig().build();
    Configuration jdbcConfig = config.subset("database.", true);

    OracleConnection jdbcConnection = new OracleConnection(jdbcConfig, new OracleConnectionFactory());

    String pdbName = new OracleConnectorConfig(config).getPdbName();

    if (pdbName != null) {
        jdbcConnection.setSessionToPdb(pdbName);
    }

    return jdbcConnection;
}
 
Example 4
Source File: OracleConnectorTask.java    From debezium-incubator with Apache License 2.0 4 votes vote down vote up
@Override
public ChangeEventSourceCoordinator start(Configuration config) {
    OracleConnectorConfig connectorConfig = new OracleConnectorConfig(config);
    TopicSelector<TableId> topicSelector = OracleTopicSelector.defaultSelector(connectorConfig);
    SchemaNameAdjuster schemaNameAdjuster = SchemaNameAdjuster.create(LOGGER);

    Configuration jdbcConfig = config.subset("database.", true);
    jdbcConnection = new OracleConnection(jdbcConfig, new OracleConnectionFactory());
    this.schema = new OracleDatabaseSchema(connectorConfig, schemaNameAdjuster, topicSelector, jdbcConnection);
    this.schema.initializeStorage();

    OffsetContext previousOffset = getPreviousOffset(new OracleOffsetContext.Loader(connectorConfig));
    if (previousOffset != null) {
        schema.recover(previousOffset);
    }

    taskContext = new OracleTaskContext(connectorConfig, schema);

    Clock clock = Clock.system();

    // Set up the task record queue ...
    this.queue = new ChangeEventQueue.Builder<DataChangeEvent>()
            .pollInterval(connectorConfig.getPollInterval())
            .maxBatchSize(connectorConfig.getMaxBatchSize())
            .maxQueueSize(connectorConfig.getMaxQueueSize())
            .loggingContextSupplier(() -> taskContext.configureLoggingContext(CONTEXT_NAME))
            .build();

    errorHandler = new ErrorHandler(OracleConnector.class, connectorConfig.getLogicalName(), queue);

    final OracleEventMetadataProvider metadataProvider = new OracleEventMetadataProvider();

    EventDispatcher<TableId> dispatcher = new EventDispatcher<>(
            connectorConfig,
            topicSelector,
            schema,
            queue,
            connectorConfig.getTableFilters().dataCollectionFilter(),
            DataChangeEvent::new,
            metadataProvider,
            schemaNameAdjuster);

    ChangeEventSourceCoordinator coordinator = new ChangeEventSourceCoordinator(
            previousOffset,
            errorHandler,
            OracleConnector.class,
            connectorConfig,
            new OracleChangeEventSourceFactory(connectorConfig, jdbcConnection, errorHandler, dispatcher, clock, schema),
            new DefaultChangeEventSourceMetricsFactory(),
            dispatcher,
            schema);

    coordinator.start(taskContext, this.queue, metadataProvider);

    return coordinator;
}