This is an automated email from the ASF dual-hosted git repository.

zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 65b3541dcfb [fix][client] Add description method to ClientBuilder 
(#24728)
65b3541dcfb is described below

commit 65b3541dcfbdb2487b485b5702692b3f0730b4fe
Author: Zixuan Liu <[email protected]>
AuthorDate: Thu Sep 11 17:56:48 2025 +0800

    [fix][client] Add description method to ClientBuilder (#24728)
---
 .../pulsar/client/api/SimpleProducerConsumerTest.java   |  3 +--
 .../org/apache/pulsar/client/api/ClientBuilder.java     | 17 +++++++++++++++++
 .../apache/pulsar/client/impl/ClientBuilderImpl.java    | 16 +---------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java
index cc43bf06ded..2b1d83be591 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java
@@ -98,7 +98,6 @@ import 
org.apache.pulsar.broker.storage.ManagedLedgerStorageClass;
 import org.apache.pulsar.client.admin.PulsarAdminException;
 import org.apache.pulsar.client.api.schema.GenericRecord;
 import org.apache.pulsar.client.impl.BatchMessageIdImpl;
-import org.apache.pulsar.client.impl.ClientBuilderImpl;
 import org.apache.pulsar.client.impl.ConsumerBase;
 import org.apache.pulsar.client.impl.ConsumerImpl;
 import org.apache.pulsar.client.impl.MessageIdImpl;
@@ -4868,7 +4867,7 @@ public class SimpleProducerConsumerTest extends 
ProducerConsumerBase {
         assertEquals(stats.getPublishers().size(), 1);
         assertEquals(stats.getPublishers().get(0).getClientVersion(), 
defaultClientVersion);
 
-        PulsarClient client = ((ClientBuilderImpl) PulsarClient.builder())
+        PulsarClient client = PulsarClient.builder()
                 .description("my-java-client")
                 .serviceUrl(lookupUrl.toString())
                 .build();
diff --git 
a/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
 
b/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
index c1ef9ed819b..034c167a9b3 100644
--- 
a/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
+++ 
b/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
@@ -717,4 +717,21 @@ public interface ClientBuilder extends Serializable, 
Cloneable {
      * - The `loadManagerClassName` config in broker is a class that 
implements the `ExtensibleLoadManager` interface
      */
     ClientBuilder lookupProperties(Map<String, String> properties);
+
+    /**
+     * Set the description.
+     *
+     * <p> By default, when the client connects to the broker, a version 
string like "Pulsar-Java-v<x.y.z>" will be
+     * carried and saved by the broker. The client version string could be 
queried from the topic stats.
+     *
+     * <p> This method provides a way to add more description to a specific 
PulsarClient instance. If it's configured,
+     * the description will be appended to the original client version string, 
with '-' as the separator.
+     *
+     * <p>For example, if the client version is 3.0.0, and the description is 
"forked", the final client version string
+     * will be "Pulsar-Java-v3.0.0-forked".
+     *
+     * @param description the description of the current PulsarClient instance
+     * @throws IllegalArgumentException if the length of description exceeds 64
+     */
+    ClientBuilder description(String description);
 }
diff --git 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java
 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java
index 7d851361505..d031c8e1710 100644
--- 
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java
+++ 
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java
@@ -477,21 +477,7 @@ public class ClientBuilderImpl implements ClientBuilder {
         return this;
     }
 
-    /**
-     * Set the description.
-     *
-     * <p> By default, when the client connects to the broker, a version 
string like "Pulsar-Java-v<x.y.z>" will be
-     * carried and saved by the broker. The client version string could be 
queried from the topic stats.
-     *
-     * <p> This method provides a way to add more description to a specific 
PulsarClient instance. If it's configured,
-     * the description will be appended to the original client version string, 
with '-' as the separator.
-     *
-     * <p>For example, if the client version is 3.0.0, and the description is 
"forked", the final client version string
-     * will be "Pulsar-Java-v3.0.0-forked".
-     *
-     * @param description the description of the current PulsarClient instance
-     * @throws IllegalArgumentException if the length of description exceeds 64
-     */
+    @Override
     public ClientBuilder description(String description) {
         if (description != null && description.length() > 64) {
             throw new IllegalArgumentException("description should be at most 
64 characters");

Reply via email to