@@ -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,11 @@ 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
80+ ) {
7481 this .policies = policies ;
7582 this .protocolOptions = protocolOptions ;
7683 this .poolingOptions = poolingOptions ;
@@ -81,6 +88,9 @@ private Configuration(
8188 this .nettyOptions = nettyOptions ;
8289 this .codecRegistry = codecRegistry ;
8390 this .defaultKeyspace = defaultKeyspace ;
91+ this .applicationName = applicationName ;
92+ this .applicationVersion = applicationVersion ;
93+ this .clientId = clientId ;
8494 }
8595
8696 /**
@@ -99,7 +109,10 @@ protected Configuration(Configuration toCopy) {
99109 toCopy .getThreadingOptions (),
100110 toCopy .getNettyOptions (),
101111 toCopy .getCodecRegistry (),
102- toCopy .getDefaultKeyspace ());
112+ toCopy .getDefaultKeyspace (),
113+ toCopy .getApplicationName (),
114+ toCopy .getApplicationVersion (),
115+ toCopy .getClientId ());
103116 }
104117
105118 void register (Cluster .Manager manager ) {
@@ -213,6 +226,19 @@ public NettyOptions getNettyOptions() {
213226 public String getDefaultKeyspace () {
214227 return defaultKeyspace ;
215228 }
229+
230+ public String getApplicationName () {
231+ return applicationName ;
232+ }
233+
234+ public String getApplicationVersion () {
235+ return applicationVersion ;
236+ }
237+
238+ public String getClientId () {
239+ return clientId ;
240+ }
241+
216242 /**
217243 * Returns the {@link CodecRegistry} instance for this configuration.
218244 *
@@ -239,6 +265,42 @@ public static class Builder {
239265 private NettyOptions nettyOptions ;
240266 private CodecRegistry codecRegistry ;
241267 private String defaultKeyspace ;
268+ private String applicationName ;
269+ private String applicationVersion ;
270+ private String clientId ;
271+
272+ /**
273+ * Sets application name, to be reported to server
274+ *
275+ * @param applicationName application name.
276+ * @return this builder.
277+ */
278+ public Builder withApplicationName (String applicationName ) {
279+ this .applicationName = applicationName ;
280+ return this ;
281+ }
282+
283+ /**
284+ * Sets application version, to be reported to server
285+ *
286+ * @param applicationVersion application version.
287+ * @return this builder.
288+ */
289+ public Builder withApplicationVersion (String applicationVersion ) {
290+ this .applicationVersion = applicationVersion ;
291+ return this ;
292+ }
293+
294+ /**
295+ * Sets client id, to be reported to server
296+ *
297+ * @param clientId application version.
298+ * @return this builder.
299+ */
300+ public Builder withClientId (String clientId ) {
301+ this .clientId = clientId ;
302+ return this ;
303+ }
242304
243305 /**
244306 * Sets the policies for this cluster.
@@ -370,7 +432,11 @@ public Configuration build() {
370432 threadingOptions != null ? threadingOptions : new ThreadingOptions (),
371433 nettyOptions != null ? nettyOptions : NettyOptions .DEFAULT_INSTANCE ,
372434 codecRegistry != null ? codecRegistry : CodecRegistry .DEFAULT_INSTANCE ,
373- defaultKeyspace );
435+ defaultKeyspace ,
436+ applicationName ,
437+ applicationVersion ,
438+ clientId
439+ );
374440 }
375441 }
376442}
0 commit comments