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

mmarshall pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.11 by this push:
     new b1c080af48f [fix][broker] REST Client Producer fails with TLS only 
(#20535)
b1c080af48f is described below

commit b1c080af48ff56a10829cb6511f0db10ceca6646
Author: maanders-tibco <84395784+maanders-ti...@users.noreply.github.com>
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 14996c35b19..3bfa1e16b7b 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 {}, "

Reply via email to