Skip to content

[fix][doc] Correct loadConf example key in PulsarAdminBuilder#25556

Merged
dao-jun merged 1 commit into
apache:masterfrom
singhvishalkr:fix-pulsar-admin-builder-loadconf-example
Apr 21, 2026
Merged

[fix][doc] Correct loadConf example key in PulsarAdminBuilder#25556
dao-jun merged 1 commit into
apache:masterfrom
singhvishalkr:fix-pulsar-admin-builder-loadconf-example

Conversation

@singhvishalkr

Copy link
Copy Markdown
Contributor

Fixes #24093

Motivation

PulsarAdminBuilder.loadConf documents an example that uses serviceHttpUrl as the config map key:

Map<String, Object> config = new HashMap<>();
config.put("serviceHttpUrl", "http://localhost:6650");

However, loadConf resolves its keys against ClientConfigurationData, whose field is declared as serviceUrl:

https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java#L60-L65

@ApiModelProperty(
        name = "serviceUrl",
        value = "Pulsar cluster HTTP URL to connect to a broker."
)
private String serviceUrl;

Copy-pasting the current example produces a silently ignored configuration entry and no admin service URL is set, which is a frustrating first-contact experience for anyone reading the API docs.

Modifications

  • pulsar-client-admin-api/.../PulsarAdminBuilder.java: change the loadConf example key from serviceHttpUrl to serviceUrl.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial Javadoc-only fix without any test coverage.

Does this pull request potentially affect one of the following parts:

None of the listed areas are affected. This is a comment-only change inside a Javadoc example.

Documentation

  • doc-not-needed

No user-facing documentation outside of this Javadoc example needs updating; the admin configuration reference already uses the correct serviceUrl key.

@dao-jun

dao-jun commented Apr 21, 2026

Copy link
Copy Markdown
Member

good catch

The loadConf Javadoc example used serviceHttpUrl as the config
map key, but PulsarAdminBuilder.loadConf maps the entries through
ClientConfigurationData, whose corresponding field is named
serviceUrl. Copy-pasting the example as-is would produce a silently
ignored configuration entry.

Change the example key to serviceUrl to match the actual
configuration field, and change the example URL scheme to
pulsar:// so the example reflects a real broker service URL
(per @merlimat's review).

Fixes apache#24093
@singhvishalkr singhvishalkr force-pushed the fix-pulsar-admin-builder-loadconf-example branch from c64107e to 7836370 Compare April 21, 2026 16:05
@singhvishalkr

Copy link
Copy Markdown
Contributor Author

Thanks @merlimat — you're right, the URL scheme should be pulsar:// to match the (corrected) key. Applied your suggestion in 7836370 and force-pushed; commit message updated to credit the scheme change to the review. Thanks @dao-jun for the 👍 on the original report.

@dao-jun

dao-jun commented Apr 21, 2026

Copy link
Copy Markdown
Member

Just to clarify, config.put("serviceUrl", "http://localhost:xxxx"); is also valid.
image

@singhvishalkr

Copy link
Copy Markdown
Contributor Author

Thanks for the clarification @dao-jun — you're right, http://localhost:xxxx is also accepted. ClientConfigurationData#serviceUrl takes both the native binary scheme (pulsar://host:6650, pulsar+ssl://host:6651) and the HTTP lookup scheme (http://host:8080, https://host:8443), so both spellings are perfectly valid values for the serviceUrl key.

I kept the example in this PR as pulsar://localhost:6650 to match @merlimat's inline suggestion and because that pairs naturally with the default broker port shown in the snippet. Happy to extend it to something like

// Any scheme accepted by PulsarAdmin is fine; e.g.
//   config.put("serviceUrl", "pulsar://localhost:6650");
//   config.put("serviceUrl", "http://localhost:8080");

if you think documenting both schemes in the Javadoc would be clearer for users landing on loadConf. Otherwise this PR is scoped purely to fixing the servicUrlserviceUrl typo and I'd rather keep the doc change minimal — LMK which you prefer and I'll push a follow-up in the same PR.

@dao-jun

dao-jun commented Apr 21, 2026

Copy link
Copy Markdown
Member

Thanks for the clarification @dao-jun — you're right, http://localhost:xxxx is also accepted. ClientConfigurationData#serviceUrl takes both the native binary scheme (pulsar://host:6650, pulsar+ssl://host:6651) and the HTTP lookup scheme (http://host:8080, https://host:8443), so both spellings are perfectly valid values for the serviceUrl key.

I kept the example in this PR as pulsar://localhost:6650 to match @merlimat's inline suggestion and because that pairs naturally with the default broker port shown in the snippet. Happy to extend it to something like

// Any scheme accepted by PulsarAdmin is fine; e.g.
//   config.put("serviceUrl", "pulsar://localhost:6650");
//   config.put("serviceUrl", "http://localhost:8080");

if you think documenting both schemes in the Javadoc would be clearer for users landing on loadConf. Otherwise this PR is scoped purely to fixing the servicUrlserviceUrl typo and I'd rather keep the doc change minimal — LMK which you prefer and I'll push a follow-up in the same PR.

No need to keep them both, this is just an example.

@dao-jun dao-jun merged commit 93d13e2 into apache:master Apr 21, 2026
43 checks passed
@lhotari lhotari added this to the 5.0.0-M1 milestone Jun 12, 2026
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.

[Doc] Typo in PulsarAdminBuilder

4 participants