|
| 1 | +# Client Configuration |
| 2 | + |
| 3 | +Client configuration allows an application to provide additional metadata to |
| 4 | +the cluster which can be useful for troubleshooting and performing diagnostics. |
| 5 | +In addition to the optional application metadata the cluster will automatically |
| 6 | +be provided with the driver's name, driver's version, and a unique session |
| 7 | +identifier. |
| 8 | + |
| 9 | +## Application Options (Optional) |
| 10 | + |
| 11 | +Application name and version metadata can be provided to the cluster during |
| 12 | +configuration. This information can be used to isolate specific applications on |
| 13 | +the server-side when troubleshooting or performing diagnostics on clusters that |
| 14 | +support multiple applications. |
| 15 | + |
| 16 | +```c |
| 17 | +CassCluster* cluster = cass_cluster_new(); |
| 18 | + |
| 19 | +/* Assign a name for the application connecting to the cluster */ |
| 20 | +cass_cluster_set_application_name(cluster, "Application Name"); |
| 21 | + |
| 22 | +/* Assign a version for the application connecting to the cluster */ |
| 23 | +cass_cluster_set_application_version(cluster, "1.0.0"); |
| 24 | + |
| 25 | +/* ... */ |
| 26 | + |
| 27 | +cass_cluster_free(cluster); |
| 28 | +``` |
| 29 | +
|
| 30 | +## Client Identification |
| 31 | +
|
| 32 | +Each session is assigned a unique identifier (UUID) which can be used to |
| 33 | +identify specific client connections server-side. The identifier can also be |
| 34 | +retrieved client-side using the following function: |
| 35 | +
|
| 36 | +```c |
| 37 | +CassSession* session = cass_session_new(); |
| 38 | +
|
| 39 | +/* Retrieve the session's unique identifier */ |
| 40 | +CassUuid client_id = cass_session_get_client_id(session); |
| 41 | +
|
| 42 | +/* ... */ |
| 43 | +
|
| 44 | +cass_session_free(session); |
| 45 | +``` |
| 46 | + |
| 47 | +**Note**: A session's unique identifier is constant for its lifetime and does |
| 48 | + not change when re-establishing connection to a cluster. |
0 commit comments