Class MySqlCdcSources.Builder<T>

java.lang.Object
com.hazelcast.enterprise.jet.cdc.DebeziumCdcSources.Builder<T>
com.hazelcast.enterprise.jet.cdc.mysql.MySqlCdcSources.Builder<T>
Type Parameters:
T - type of items produced by the source
Enclosing class:
MySqlCdcSources

public static final class MySqlCdcSources.Builder<T> extends DebeziumCdcSources.Builder<T>
Builder for configuring a CDC source that streams change data from a MySQL database to Hazelcast Jet.
  • Method Details

    • setSnapshotMode

      @Nonnull public MySqlCdcSources.Builder<T> setSnapshotMode(@Nonnull DebeziumSnapshotMode snapshotMode)
      Snapshot mode that will be used by the connector.

      If you want to use BinlogConnectorConfig.SnapshotMode.CUSTOM, please use setCustomSnapshotter(Class) method instead.

    • setCustomSnapshotter

      @Nonnull public MySqlCdcSources.Builder<T> setCustomSnapshotter(@Nonnull Class<?> snapshotterClass)
      Custom snapshotter that will be used by the connector.
    • setDatabaseClientId

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseClientId(int clientId)
      A numeric ID of this database client, which must be unique across all currently-running database processes in the MySQL cluster. This connector joins the MySQL database cluster as another server (with this unique ID) so it can read the binlog. By default, a random number is generated between 5400 and 6400, though we recommend setting an explicit value.
    • setDatabaseAddress

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseAddress(@Nonnull String address, int port)
      IP address or hostname and the port of the database server, has to be specified.
    • setDatabaseCredentials

      public MySqlCdcSources.Builder<T> setDatabaseCredentials(@Nonnull String user, @Nonnull String password)
      Database user and password for connecting to the database server. Has to be specified.
    • setDatabaseAddress

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseAddress(@Nonnull String address)
      IP address or hostname of the database server, has to be specified.
    • setDatabasePort

      @Nonnull public MySqlCdcSources.Builder<T> setDatabasePort(int port)
      Optional port number of the database server, if unspecified defaults to the database specific default port (5432).
    • setDatabaseUser

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseUser(@Nonnull String user)
      Database user for connecting to the database server. Has to be specified.
    • setDatabasePassword

      @Nonnull public MySqlCdcSources.Builder<T> setDatabasePassword(@Nonnull String password)
      Database user password for connecting to the database server. Has to be specified.
    • setDatabaseName

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseName(@Nonnull String dbName)
      The name of the MySQL database from which to stream the changes. Has to be set.

      Currently, this source is not capable of monitoring multiple databases, only multiple schemas and/or tables. See white- and black-listing configuration options for those.

    • setSchemaIncludeList

      @Nonnull public MySqlCdcSources.Builder<T> setSchemaIncludeList(@Nonnull String... schemaNameRegExps)
      Optional regular expressions that match schema names to be monitored ("schema" is used here to denote logical groups of tables). Any schema name not included in the whitelist will be excluded from monitoring. By default, all non-system schemas will be monitored. May not be used with schema blacklist.
    • setSchemaExcludeList

      @Nonnull public MySqlCdcSources.Builder<T> setSchemaExcludeList(@Nonnull String... schemaNameRegExps)
      Optional regular expressions that match schema names to be excluded from monitoring ("schema" is used here to denote logical groups of tables). Any schema name not included in the blacklist will be monitored, except system schemas. May not be used with schema whitelist.
    • setDatabaseIncludeList

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseIncludeList(@Nonnull String... databaseNameRegExps)
      Optional regular expressions that match databases to be monitored; any database not included in the include list will be excluded from monitoring. By default, the connector will monitor all databases. May not be used with database exclude list.
      Overrides:
      setDatabaseIncludeList in class DebeziumCdcSources.Builder<T>
    • setDatabaseExcludeList

      @Nonnull public MySqlCdcSources.Builder<T> setDatabaseExcludeList(@Nonnull String... databaseNameRegExps)
      Optional regular expressions that match databases to be excluded from monitoring; any table not included in the exclude list will be monitored. May not be used with database include list.
      Overrides:
      setDatabaseExcludeList in class DebeziumCdcSources.Builder<T>
    • setTableIncludeList

      @Nonnull public MySqlCdcSources.Builder<T> setTableIncludeList(@Nonnull String... tableNameRegExps)
      Optional regular expressions that match fully-qualified table identifiers for tables to be monitored; any table not included in the whitelist will be excluded from monitoring. Each identifier is of the form schemaName.tableName. By default, the connector will monitor every non-system table in each monitored database. May not be used with table exclude list.
      Overrides:
      setTableIncludeList in class DebeziumCdcSources.Builder<T>
    • setTableExcludeList

      @Nonnull public MySqlCdcSources.Builder<T> setTableExcludeList(@Nonnull String... tableNameRegExps)
      Optional regular expressions that match fully-qualified table identifiers for tables to be excluded from monitoring; any table not included in the blacklist will be monitored. Each identifier is of the form schemaName.tableName. May not be used with table whitelist.
      Overrides:
      setTableExcludeList in class DebeziumCdcSources.Builder<T>
    • setColumnIncludeList

      @Nonnull public MySqlCdcSources.Builder<T> setColumnIncludeList(@Nonnull String... columnNameRegExps)
      Optional regular expressions that match the fully-qualified names of columns that should be excluded from change event message values. Fully-qualified names for columns are of the form schemaName.tableName.columnName.
    • setSslMode

      @Nonnull public MySqlCdcSources.Builder<T> setSslMode(@Nonnull String mode)
      Specifies whether to use an encrypted connection to the database. The default is disable, and specifies to use an unencrypted connection.

      The require option establishes an encrypted connection but will fail if one cannot be made for any reason.

      The verify_ca option behaves like require but additionally it verifies the server TLS certificate against the configured Certificate Authority (CA) certificates and will fail if it doesn’t match any valid CA certificates.

      The verify-full option behaves like verify_ca but additionally verifies that the server certificate matches the host of the remote connection.

    • setSslCertificateFile

      @Nonnull public MySqlCdcSources.Builder<T> setSslCertificateFile(@Nonnull String file)
      Specifies the (path to the) file containing the SSL Certificate for the database client.
    • setSslKeyFile

      @Nonnull public MySqlCdcSources.Builder<T> setSslKeyFile(@Nonnull String file)
      Specifies the (path to the) file containing the SSL private key of the database client.
    • setSslKeyFilePassword

      @Nonnull public MySqlCdcSources.Builder<T> setSslKeyFilePassword(@Nonnull String password)
      Specifies the password to be used to access the SSL key file, if specified.

      Mandatory if key file specified.

    • setSslRootCertificateFile

      @Nonnull public MySqlCdcSources.Builder<T> setSslRootCertificateFile(@Nonnull String file)
      Specifies the file containing SSL certificate authority (CA) certificate(s).
    • changeRecord

      @Nonnull public MySqlCdcSources.Builder<ChangeRecord> changeRecord()
      Sets the return type of the source to ChangeRecord.
      Overrides:
      changeRecord in class DebeziumCdcSources.Builder<T>
    • json

      @Nonnull public MySqlCdcSources.Builder<Map.Entry<String,String>> json()
      Sets the return type of the source to Map.Entry with key and value being SourceRecord's key and value, parsed to json string.
      Overrides:
      json in class DebeziumCdcSources.Builder<T>
    • customMapping

      @Nonnull public <T_NEW> MySqlCdcSources.Builder<T_NEW> customMapping(@Nonnull RecordMappingFunction<T_NEW> recordMappingFunction)
      Sets the return type of the source to user defined #T_NEW type. Mapping will be performed by user-defined mapping function.
      Overrides:
      customMapping in class DebeziumCdcSources.Builder<T>
    • withSequenceExtractor

      @Nonnull public MySqlCdcSources.Builder<T> withSequenceExtractor(Class<? extends SequenceExtractor> sequenceExtractorClass)
      Sets the SequenceExtractor class property.

      Sequence extractor is used to determine monotonically increasing order of CDC order, that can be used later in WriteCdcP.

      Overrides:
      withSequenceExtractor in class DebeziumCdcSources.Builder<T>
      Parameters:
      sequenceExtractorClass - Class of the SequenceExtractor implementation. Must be on the classpath during execution.
    • withDefaultEngine

      @Nonnull public MySqlCdcSources.Builder<T> withDefaultEngine()
      Changes the engine used to default embedded engine.

      This engine is most predictable as it's single-threaded. If you want to use multiple threads for event reading, please use withAsyncEngine().

      Overrides:
      withDefaultEngine in class DebeziumCdcSources.Builder<T>
    • withAsyncEngine

      @Nonnull public MySqlCdcSources.Builder<T> withAsyncEngine()
      Changes the engine used to async embedded engine.

      Async engine allows multithreaded reading, however you need to deal with async world and it's quirks - like the fact that we've observed that initial offsets are set after engine starts reading, causing some additional records to be read (that were before saved last committed offset).

      Overrides:
      withAsyncEngine in class DebeziumCdcSources.Builder<T>
    • withErrorMaxRetries

      @Nonnull public MySqlCdcSources.Builder<T> withErrorMaxRetries(int errorRetryCount)
      Sets the maximum retry count in case of errors.

      Default value is -1, which means infinite retries.

      Overrides:
      withErrorMaxRetries in class DebeziumCdcSources.Builder<T>
    • setProperty

      @Nonnull public MySqlCdcSources.Builder<T> setProperty(@Nonnull String key, @Nonnull String value)
      Sets a source property. These properties are passed to Debezium.
      Overrides:
      setProperty in class DebeziumCdcSources.Builder<T>
    • setProperty

      @Nonnull public MySqlCdcSources.Builder<T> setProperty(@Nonnull String key, long value)
      Sets a source property. These properties are passed to Debezium.
      Overrides:
      setProperty in class DebeziumCdcSources.Builder<T>
    • setProperty

      @Nonnull public MySqlCdcSources.Builder<T> setProperty(@Nonnull String key, boolean value)
      Sets a source property. These properties are passed to Debezium.
      Overrides:
      setProperty in class DebeziumCdcSources.Builder<T>
    • setProperty

      @Nonnull public MySqlCdcSources.Builder<T> setProperty(@Nonnull String key, int value)
      Sets a source property. These properties are passed to Debezium.
      Overrides:
      setProperty in class DebeziumCdcSources.Builder<T>
    • build

      @Nonnull public com.hazelcast.jet.pipeline.StreamSource<T> build()
      Returns the source based on the properties set so far.
      Overrides:
      build in class DebeziumCdcSources.Builder<T>