This is an automated email from the ASF dual-hosted git repository.
mmarshall pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new 82942de8efe [fix][broker] REST Client Producer fails with TLS only
(#20535)
82942de8efe is described below
commit 82942de8efe0dc0b91925909bd1dc27c357c51e3
Author: maanders-tibco <[email protected]>
AuthorDate: Thu Jun 8 21:29:00 2023 -0500
[fix][broker] REST Client Producer fails with TLS only (#20535)
Co-authored-by: Matt Anderson <>
Fixes #20536
### Motivation
When disabling HTTP ports in the Pulsar broker, the [REST Client
Producer](https://pulsar.apache.org/docs/3.0.x/client-libraries-rest/) fails to
produce messages. For reproduction steps, please reference issue details.
### Modifications
Change the following lines:
```java
LookupResult result = optionalResult.get();
if
(result.getLookupData().getHttpUrl().equals(pulsar().getWebServiceAddress())) {
// Current broker owns the topic, add to owning topic.
```
To:
```java
LookupResult result = optionalResult.get();
if
(result.getLookupData().getHttpUrl().equals(pulsar().getWebServiceAddress())
||
result.getLookupData().getHttpUrlTls().equals(pulsar().getWebServiceAddressTls()))
{
// Current broker owns the topic, add to owning topic.
```
### Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
(outside of the reproduction tests described in the #20536)
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [x] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: https://github.com/maanders-tibco/pulsar
<!--
After opening this PR, the build in apache/pulsar will fail and
instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since
the
apache/pulsar CI based on GitHub Actions has constrained resources and
quota.
GitHub Actions provides separate quota for pull requests that are executed
in
a forked repository.
The tests will be run in the forked repository until all PR review comments
have
been handled, the tests pass and the PR is approved by a reviewer.
-->
(cherry picked from commit 005cce11d0d67cdf7b08305bed55cd2f9ba7f4f0)
---
.../src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java
index e550605437f..c46c8de24ce 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java
@@ -431,7 +431,8 @@ public class TopicsBase extends PersistentTopicsBase {
}
LookupResult result = optionalResult.get();
- if
(result.getLookupData().getHttpUrl().equals(pulsar().getWebServiceAddress())) {
+ if
(result.getLookupData().getHttpUrl().equals(pulsar().getWebServiceAddress())
+ ||
result.getLookupData().getHttpUrlTls().equals(pulsar().getWebServiceAddressTls()))
{
// Current broker owns the topic, add to owning topic.
if (log.isDebugEnabled()) {
log.debug("Complete topic look up for rest produce message
request for topic {}, "