@@ -59,6 +59,9 @@ public static Builder builder() {
5959 private final NettyOptions nettyOptions ;
6060 private final CodecRegistry codecRegistry ;
6161 private final String defaultKeyspace ;
62+ private final String applicationName ;
63+ private final String applicationVersion ;
64+ private final String clientId ;
6265
6366 private Configuration (
6467 Policies policies ,
@@ -70,7 +73,10 @@ private Configuration(
7073 ThreadingOptions threadingOptions ,
7174 NettyOptions nettyOptions ,
7275 CodecRegistry codecRegistry ,
73- String defaultKeyspace ) {
76+ String defaultKeyspace ,
77+ String applicationName ,
78+ String applicationVersion ,
79+ String clientId ) {
7480 this .policies = policies ;
7581 this .protocolOptions = protocolOptions ;
7682 this .poolingOptions = poolingOptions ;
@@ -81,6 +87,9 @@ private Configuration(
8187 this .nettyOptions = nettyOptions ;
8288 this .codecRegistry = codecRegistry ;
8389 this .defaultKeyspace = defaultKeyspace ;
90+ this .applicationName = applicationName ;
91+ this .applicationVersion = applicationVersion ;
92+ this .clientId = clientId ;
8493 }
8594
8695 /**
@@ -99,7 +108,10 @@ protected Configuration(Configuration toCopy) {
99108 toCopy .getThreadingOptions (),
100109 toCopy .getNettyOptions (),
101110 toCopy .getCodecRegistry (),
102- toCopy .getDefaultKeyspace ());
111+ toCopy .getDefaultKeyspace (),
112+ toCopy .getApplicationName (),
113+ toCopy .getApplicationVersion (),
114+ toCopy .getClientId ());
103115 }
104116
105117 void register (Cluster .Manager manager ) {
@@ -213,6 +225,19 @@ public NettyOptions getNettyOptions() {
213225 public String getDefaultKeyspace () {
214226 return defaultKeyspace ;
215227 }
228+
229+ public String getApplicationName () {
230+ return applicationName ;
231+ }
232+
233+ public String getApplicationVersion () {
234+ return applicationVersion ;
235+ }
236+
237+ public String getClientId () {
238+ return clientId ;
239+ }
240+
216241 /**
217242 * Returns the {@link CodecRegistry} instance for this configuration.
218243 *
@@ -239,6 +264,42 @@ public static class Builder {
239264 private NettyOptions nettyOptions ;
240265 private CodecRegistry codecRegistry ;
241266 private String defaultKeyspace ;
267+ private String applicationName ;
268+ private String applicationVersion ;
269+ private String clientId ;
270+
271+ /**
272+ * Sets application name, to be reported to server
273+ *
274+ * @param applicationName application name.
275+ * @return this builder.
276+ */
277+ public Builder withApplicationName (String applicationName ) {
278+ this .applicationName = applicationName ;
279+ return this ;
280+ }
281+
282+ /**
283+ * Sets application version, to be reported to server
284+ *
285+ * @param applicationVersion application version.
286+ * @return this builder.
287+ */
288+ public Builder withApplicationVersion (String applicationVersion ) {
289+ this .applicationVersion = applicationVersion ;
290+ return this ;
291+ }
292+
293+ /**
294+ * Sets client id, to be reported to server
295+ *
296+ * @param clientId application version.
297+ * @return this builder.
298+ */
299+ public Builder withClientId (String clientId ) {
300+ this .clientId = clientId ;
301+ return this ;
302+ }
242303
243304 /**
244305 * Sets the policies for this cluster.
@@ -370,7 +431,10 @@ public Configuration build() {
370431 threadingOptions != null ? threadingOptions : new ThreadingOptions (),
371432 nettyOptions != null ? nettyOptions : NettyOptions .DEFAULT_INSTANCE ,
372433 codecRegistry != null ? codecRegistry : CodecRegistry .DEFAULT_INSTANCE ,
373- defaultKeyspace );
434+ defaultKeyspace ,
435+ applicationName ,
436+ applicationVersion ,
437+ clientId );
374438 }
375439 }
376440}
0 commit comments