Aiven-Open / Aiven-Open/bigquery-connector-for-apache-kafka
Move configuration based properties into configuration methods
- 主要言語
- 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 はまだ評価されていません。