Aiven-Open / Aiven-Open/bigquery-connector-for-apache-kafka

Move configuration based properties into configuration methods

オープン
#100 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Java
スター
37
フォーク
45
平均マージ
19時間 50分
マージ済み PR(30日)
5

説明

Currently we have code like

```
autoCreateTables = config.getBoolean(BigQuerySinkConfig.TABLE_CREATE_CONFIG);
upsertDelete = config.getBoolean(BigQuerySinkConfig.UPSERT_ENABLED_CONFIG)
|| config.getBoolean(BigQuerySinkConfig.DELETE_ENABLED_CONFIG);

useCredentialsProjectId = config.getBoolean(BigQuerySinkConfig.USE_CREDENTIALS_PROJECT_ID_CONFIG);
useStorageApi = config.getBoolean(BigQuerySinkConfig.USE_STORAGE_WRITE_API_CONFIG);
useStorageApiBatchMode = useStorageApi && config.getBoolean(BigQuerySinkConfig.ENABLE_BATCH_MODE_CONFIG);

retry = config.getInt(BigQuerySinkConfig.BIGQUERY_RETRY_CONFIG);
retryWait = config.getLong(BigQuerySinkConfig.BIGQUERY_RETRY_WAIT_CONFIG);
allowNewBigQueryFields = config.getBoolean(BigQuerySinkConfig.ALLOW_NEW_BIGQUERY_FIELDS_CONFIG);
allowRequiredFieldRelaxation = config.getBoolean(BigQuerySinkConfig.ALLOW_BIGQUERY_REQUIRED_FIELD_RELAXATION_CONFIG);
```

Where the configuration logic is scattered across the system in various places.

These should be implemented within the configuration class.

```
autoCreateTables = config.autoCreateTables();
upsertDelete = config.upsertDelete();

useCredentialsProjectId = config.useCredentialsFromProjectId();
useStorageApi = config.useStorageApi();
useStorageApiBatchMode = config.useStorageApiBatchMode();

RetryConfig retryCfg = config.getRetryConfig();
allowNewBigQueryFields = config.allowNewBigQueryFields();
allowRequiredFieldRelaxation = config.allowRequiredFieldRelaxation();
```

Where `RetryConfig` is

```
Interface RetryConfig {
int getCount();
long getDelay()
}
```

That will encapsulate the conversions and logic gymnastics into the config class keep the code cleaner.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。