Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-java-client] Client V2 Configuration Docs #2707

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

chernser
Copy link
Contributor

Summary

  • Added list of all JAVA Client V2 configuration parameters
  • Added documentation for authentication method.

Checklist

@chernser chernser closed this Nov 1, 2024
@chernser chernser reopened this Nov 1, 2024
@chernser chernser marked this pull request as ready for review November 1, 2024 21:23
@chernser chernser requested a review from a team as a code owner November 1, 2024 21:23
@chernser chernser requested review from mzitnik and removed request for a team November 1, 2024 21:23
| httpHeader(String key, Collection values) | - `key` - HTTP header key.<br /> - `values` - list of string values. | Sets values for a single HTTP header. Previous value is overriden.|
| httpHeaders(Map headers) | - `header` - map with HTTP headers and their values. | Sets multiple HTTP header values at a time. |
| serverSetting(String name, String value) | - `name` - name of a query level setting.<br /> - `value` - string value of the setting. | Sets query level setting to be sent along with every request. Operation settings may override it. See [Query Level Settings](/docs/en/operations/settings/query-level) for more information. |
| serverSetting(String name, Collection values) | - `name` - name of a query level setting.<br /> - `values` - string values of the setting. | Sets query level setting values to be sent along with every request. Operation settings may be override it. This method is useful to set settings with multiple values, for example [roles](/docs/en/interfaces/http#setting-role-with-query-parameters) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of a query level setting.

Does it set the server setting? I'd rephrase it something like clickhouse setting set for each query

| useAsyncRequests(boolean async) | `async` - flag that indicates if the option should be enabled. | Sets if client should execute request in a separate thread. Disabled by default because application knows better how to organize multithreaded tasks and running tasks in separate thread do not help with performance. |
| setSharedOperationExecutor(ExecutorService executorService) | `executorService` - instance of executor service. | Sets executor service for operation tasks. |
| setClientNetworkBufferSize(int size) | - `size` - size in bytes | Sets size of a buffer in application memory space that is used to copy data back-and-forth between socket and application. Greater reduces system calls to TCP stack, but affects how much memory is spent on every connection. This buffer is also subject for GC because connections are shortlive. Also keep in mind that allocating big continious block of memory might be a problem. |
| retryOnFailures(ClientFaultCause ...causes) | - `causes` - array of causes that causes retry | Set if client should retry on certain faults. This option is useful to avoid some infrequent problems like staled connection. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unclear how causes looks like. can we add a link to an example?

|---------------------------------------|:-----------------------------------------------|:--------------------------------------------|
| addEndpoint(String endpoint) | - `enpoint` - URL formatted a server address. | Adds a server endpoint to list of available servers. Currently only one endpoint is supported. |
| addEndpoint(Protocol protocol, String host, int port, boolean secure) | - `protocol` - connection protocol `com.clickhouse.client.api.enums.Protocol#HTTP`.<br />- `host` - IP or hostname of a server.<br />- `secure` - if communication should use secure version of the protocol (HTTPs) | Adds a server endpoint to list of available servers. Currently only one endpoint is supported. |
| setOption(String key, String value) | - `key` - String key of an option.<br /> - `value` - String value of an option | Sets raw value of client options. Useful when reading configuration from properties files. It helps to avoid calling corresponding builder methods. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

key - String key of a client configuration option.

should add a link to the list of client configuration options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but we do not have such list yet. Will work on it in 0.7.2 release.


Authentication is configured per client at the initialization phase. There are three authentication methods supported: by password, by access token, by SSL Client Certificate.

Authentication by a password requires to `setUsername()` and `setPassword()`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"requires calls to" or "requires using"

.build();
```

Authentication by an access token requires to `setAccessToken()`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea here too

.build();
```

Authentication by a SSL Client Certificate require to `setUsername()`, enable SSL Authentication `useSSLAuthentication`, `setClientCertificate()` and `setClientKey`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -116,4 +116,7 @@ JDBC Drive inherits same features as underlying client implementation. Other JDB
- All projects in this repo are tested with all [active LTS versions](https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease) of ClickHouse.
- [Support policy](https://github.com/ClickHouse/ClickHouse/blob/master/SECURITY.md#security-change-log-and-support)
- We recommend to upgrade client continuously to not miss security fixes and new improvements
- If you have an issue with migration to v2 API - [create and issue](https://github.com/ClickHouse/clickhouse-java/issues/new?assignees=&labels=v2-feedback&projects=&template=v2-feedback.md&title=) and we will respond!
- If you have an issue with migration to v2 API - [create and issue](https://github.com/ClickHouse/clickhouse-java/issues/new?assignees=&labels=v2-feedback&projects=&template=v2-feedback.md&title=) and we will respond!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"create an issue"

@chernser chernser merged commit 9c1dcbf into main Nov 5, 2024
4 checks passed
@chernser chernser deleted the java_client_docs_update branch November 5, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants