(pulsar-client-go) branch master updated: Fix custom value with `/` (#1229)

2024-06-26 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
 new 552b541f Fix custom value with `/` (#1229)
552b541f is described below

commit 552b541fa7e3de339739a262e63e3d7ee6d554ee
Author: Donglai Fu 
AuthorDate: Wed Jun 26 14:40:51 2024 +0800

Fix custom value with `/` (#1229)
---
 pulsaradmin/pkg/admin/brokers_test.go | 62 +++
 pulsaradmin/pkg/rest/client.go| 14 
 2 files changed, 76 insertions(+)

diff --git a/pulsaradmin/pkg/admin/brokers_test.go 
b/pulsaradmin/pkg/admin/brokers_test.go
index 5be90f6c..45c1dce2 100644
--- a/pulsaradmin/pkg/admin/brokers_test.go
+++ b/pulsaradmin/pkg/admin/brokers_test.go
@@ -18,10 +18,15 @@
 package admin
 
 import (
+   "encoding/json"
+   "net/http"
+   "net/url"
"os"
"testing"
 
+   "github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/auth"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/admin/config"
+   "github.com/apache/pulsar-client-go/pulsaradmin/pkg/rest"
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
"github.com/stretchr/testify/assert"
 )
@@ -91,3 +96,60 @@ func TestUpdateDynamicConfiguration(t *testing.T) {
assert.NoError(t, err)
assert.NotEmpty(t, configurations)
 }
+
+func TestUpdateDynamicConfigurationWithCustomURL(t *testing.T) {
+   readFile, err := 
os.ReadFile("../../../integration-tests/tokens/admin-token")
+   assert.NoError(t, err)
+   cfg := {
+   WebServiceURL: DefaultWebServiceURL,
+   Token: string(readFile),
+   }
+
+   authProvider, err := auth.GetAuthProvider(cfg)
+   assert.NoError(t, err)
+
+   client := rest.Client{
+   ServiceURL:  cfg.WebServiceURL,
+   VersionInfo: ReleaseVersion,
+   HTTPClient: {
+   Timeout:   DefaultHTTPTimeOutDuration,
+   Transport: authProvider,
+   },
+   }
+   u, err := url.Parse(cfg.WebServiceURL)
+   assert.NoError(t, err)
+
+   // example config value with '/'
+   value := `{"key/123":"https://example.com/"}`
+   encoded := url.QueryEscape(value)
+
+   resp, err := client.MakeRequestWithURL(http.MethodPost, {
+   Scheme: u.Scheme,
+   User:   u.User,
+   Host:   u.Host,
+   // use this config to test, will restore it later
+   Path:
"/admin/v2/brokers/configuration/allowAutoSubscriptionCreation/" + value,
+   RawPath: 
"/admin/v2/brokers/configuration/allowAutoSubscriptionCreation/" + encoded,
+   })
+   assert.NoError(t, err)
+   defer resp.Body.Close()
+   assert.Equal(t, http.StatusOK, resp.StatusCode)
+
+   // get the config, check if it's updated
+   admin, err := New(cfg)
+   assert.NoError(t, err)
+   assert.NotNil(t, admin)
+
+   configurations, err := admin.Brokers().GetAllDynamicConfigurations()
+   assert.NoError(t, err)
+   assert.NotEmpty(t, configurations)
+
+   var m map[string]interface{}
+   err = 
json.Unmarshal([]byte(configurations["allowAutoSubscriptionCreation"]), )
+   assert.NoError(t, err)
+   assert.Equal(t, "https://example.com/;, m["key/123"])
+
+   // restore the config
+   err = 
admin.Brokers().UpdateDynamicConfiguration("allowAutoSubscriptionCreation", 
"true")
+   assert.NoError(t, err)
+}
diff --git a/pulsaradmin/pkg/rest/client.go b/pulsaradmin/pkg/rest/client.go
index e6b603f5..9878ec41 100644
--- a/pulsaradmin/pkg/rest/client.go
+++ b/pulsaradmin/pkg/rest/client.go
@@ -104,6 +104,20 @@ func (c *Client) MakeRequest(method, endpoint string) 
(*http.Response, error) {
return resp, nil
 }
 
+func (c *Client) MakeRequestWithURL(method string, urlOpt *url.URL) 
(*http.Response, error) {
+   req := {
+   method: method,
+   url:urlOpt,
+   params: make(url.Values),
+   }
+   resp, err := checkSuccessful(c.doRequest(req))
+   if err != nil {
+   return nil, err
+   }
+
+   return resp, nil
+}
+
 func (c *Client) Get(endpoint string, obj interface{}) error {
_, err := c.GetWithQueryParams(endpoint, obj, nil, true)
return err



(pulsar-site) branch main updated: [feat] add summit events 2024 display (#786)

2024-02-07 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
 new 347d54cd4136 [feat] add summit events 2024 display (#786)
347d54cd4136 is described below

commit 347d54cd4136453dfd559b3c6fd56019b4aa266a
Author: Li Li 
AuthorDate: Thu Feb 8 15:12:14 2024 +0800

[feat] add summit events 2024 display (#786)

* [feat] summit events 2024 display

Signed-off-by: lili 

* Update date
---
 data/events.ts  | 271 +---
 src/components/pages/EventsPage/Cards/Cards.tsx |   8 +-
 2 files changed, 153 insertions(+), 126 deletions(-)

diff --git a/data/events.ts b/data/events.ts
index 084bedc74221..24065e8a1af2 100644
--- a/data/events.ts
+++ b/data/events.ts
@@ -21,129 +21,150 @@ export type Resource = {
 };
 
 export const resources: Record = {
-events: [
-  {
-title: 'Pulsar Summit Europe 2023',
-description: '',
-link: 
'https://streamnative.io/blog/pulsar-virtual-summit-europe-2023-on-demand-videos-available-now',
-displayDate: '23 May 2023',
-startDate: '2023-05-23' // year-month-day
-  },
-  {
-title: 'Pulsar Summit San Francisco 2022',
-description: '',
-link: 'https://pulsar-summit.org/event/san-francisco-2022',
-displayDate: '18 Aug 2022',
-startDate: '2022-08-18' // year-month-day
-  },
-  {
-title: 'Pulsar Summit Europe 2021 ',
-description: '',
-link: 'https://pulsar-summit.org/en/event/europe-2021',
-displayDate: '6 Oct 2021',
-startDate: '2021-10-06' // year-month-day
-  },
-  {
-title: 'Pulsar Summit Asia 2021',
-description: '',
-link: 'https://pulsar-summit.org/en/event/asia-2021',
-displayDate: '20-21 November 2021',
-startDate: '2021-11-20' // year-month-day
-  },
-  {
-title: 'Pulsar Summit North America 2021',
-description: '',
-link: 'https://pulsar-summit.org/en/event/north-america-2021',
-displayDate: '16-17 June 2021',
-startDate: '2021-06-16' // year-month-day
-  },
-  {
-title: 'Pulsar Summit Asia 2020',
-description: '',
-link: 
'https://www.youtube.com/playlist?list=PLqRma1oIkcWjHlRb-dzjwYdETkVlyCJOq',
-displayDate: '28-29 November 2020',
-startDate: '2021-11-28' // year-month-day
-  },
-  {
-title: 'Pulsar Summit Virtual Conference 2020',
-description: '',
-link: 
'https://www.youtube.com/playlist?list=PLqRma1oIkcWjVlPfaWlf3VO9W-XWsF_4-',
-displayDate: '17-18 June 2020',
-startDate: '2021-06-17' // year-month-day
-  },
-  {
-title: 'ApacheCon @Home',
-description: '',
-link: 
'https://www.youtube.com/watch?v=iIABx20uvmw=PLU2OcwpQkYCy_awEe5xwlxGTk5UieA37m',
-displayDate: '29 June 2020',
-startDate: '2020-06-29' // year-month-day
-  },
-  {
-title: 'Pulsar Summit Virtual Conference ',
-description: '',
-link: 
'https://www.youtube.com/playlist?list=PLqRma1oIkcWjVlPfaWlf3VO9W-XWsF_4-',
-displayDate: '9 September 2020',
-startDate: '2020-09-09' // year-month-day
-  }
-],
-meetups: [
-  {
-title: 'NorCal Apache Pulsar Neighborhood Meetup Group',
-description: '',
-link: 'https://www.meetup.com/nor-cal-apache-pulsar-meetup-group/',
-  },
-  {
-title: 'Netherlands Apache Pulsar Meetup Group',
-description: '',
-link: 'https://www.meetup.com/netherlands-apache-pulsar-meetup/'
-  },
-  {
-title: 'SoCal Apache Pulsar Neighborhood Meetup Group',
-description: '',
-link: 'https://www.meetup.com/socal-apache-pulsar-meetup-group/'
-  },
-  {
-title: 'New York City Apache Pulsar Meetup',
-description: '',
-link: 'https://www.meetup.com/new-york-city-apache-pulsar-meetup/'
-  },
-  {
-title: 'Beijing Apache Pulsar® Meetup by StreamNative',
-description: '',
-link: 
'https://www.meetup.com/beijing-apache-pulsar-meetup-by-streamnative/'
-  },
-  {
-title: 'SF Bay Area Apache Pulsar Meetup',
-description: '',
-link: 'https://www.meetup.com/SF-Bay-Area-Apache-Pulsar-Meetup/'
-  },
-  {
-title: 'Japan Pulsar User Group',
-description: '',
-link: 'https://japan-pulsar-user-group.connpass.com/'
-  },
-],
-playlists: [
-  {
-title: 'Pulsar Summit Europe 2021',
-description: '',
-link: 
'https://www.youtube.com/playlist?list=PLqRma1oIkcWh7zes7mNeTUCr2iU-2C1jB',
-  },
-  {
-title: 'Pulsar Summit North America 2021',
-description

(pulsar-site) branch summit-events-2024 updated (5f955d222b12 -> 322e3e060e94)

2024-02-07 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch summit-events-2024
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


from 5f955d222b12 [feat] summit events 2024 display
 add 322e3e060e94 Update date

No new revisions were added by this update.

Summary of changes:
 data/events.ts | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)



[pulsar-client-go] branch master updated: Support load config from env (#1089)

2023-09-07 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
 new 28a6b491 Support load config from env (#1089)
28a6b491 is described below

commit 28a6b49159a7474facdb6dc5d675fae427d8a1f8
Author: Guangning E 
AuthorDate: Thu Sep 7 20:38:55 2023 +0800

Support load config from env (#1089)

* Support load config from env
* Run goimport
---
 pulsaradmin/pkg/admin/auth/oauth2.go |  8 ++--
 pulsaradmin/pkg/utils/utils.go   | 10 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/pulsaradmin/pkg/admin/auth/oauth2.go 
b/pulsaradmin/pkg/admin/auth/oauth2.go
index eab64cac..2864eae2 100644
--- a/pulsaradmin/pkg/admin/auth/oauth2.go
+++ b/pulsaradmin/pkg/admin/auth/oauth2.go
@@ -19,9 +19,12 @@ package auth
 
 import (
"encoding/json"
+   "fmt"
"net/http"
"path/filepath"
 
+   "github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
+
"github.com/99designs/keyring"
"github.com/apache/pulsar-client-go/oauth2"
"github.com/apache/pulsar-client-go/oauth2/cache"
@@ -243,8 +246,9 @@ func makeKeyring() (keyring.Keyring, error) {
ServiceName:  serviceName,
KeychainName: keyChainName,
KeychainTrustApplication: true,
-   FileDir:  filepath.Join("~/.config/pulsar", 
"credentials"),
-   FilePasswordFunc: keyringPrompt,
+   FileDir: filepath.Join(fmt.Sprintf(
+   "%s/.config/pulsar", utils.GetConfigPath()), 
"credentials"),
+   FilePasswordFunc: keyringPrompt,
})
 }
 
diff --git a/pulsaradmin/pkg/utils/utils.go b/pulsaradmin/pkg/utils/utils.go
index 7b23b156..fc0897ca 100644
--- a/pulsaradmin/pkg/utils/utils.go
+++ b/pulsaradmin/pkg/utils/utils.go
@@ -19,6 +19,7 @@ package utils
 
 import (
"fmt"
+   "os"
"reflect"
 )
 
@@ -36,3 +37,12 @@ func IsNilFixed(i interface{}) bool {
}
return false
 }
+
+func GetConfigPath() string {
+   // pulsar client config dir path, for example: PULSAR_CLIENT_CONF_PATH: 
/home/pulsar
+   // configuration file path is: /home/pulsar/.config/pulsar
+   if envConf, ok := os.LookupEnv("PULSAR_CLIENT_CONF_PATH"); ok {
+   return envConf
+   }
+   return HomeDir()
+}



[pulsar] branch master updated (98628845aa9 -> e41883e23b5)

2023-08-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 98628845aa9 [fix][test] Fix flaky test 
`testCloseTransactionBufferWhenTimeout` and close producer/consumer (#20956)
 add e41883e23b5 [fix][broker]Check that the super user role is in the 
MultiRolesTokenAuthorizationProvider plugin (#20939)

No new revisions were added by this update.

Summary of changes:
 .../MultiRolesTokenAuthorizationProvider.java  | 13 +
 .../MultiRolesTokenAuthorizationProviderTest.java  | 32 ++
 2 files changed, 40 insertions(+), 5 deletions(-)



[pulsar] branch master updated: [fix][broker] Gracefully shutdown does not work with admin cli in standalone (#20709)

2023-07-26 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 362c4f4966a [fix][broker] Gracefully shutdown does not work with admin 
cli in standalone (#20709)
362c4f4966a is described below

commit 362c4f4966a59bdb612ba4369d63bcfb23419e32
Author: Kim, Joo Hyuk 
AuthorDate: Wed Jul 26 15:08:16 2023 +0900

[fix][broker] Gracefully shutdown does not work with admin cli in 
standalone (#20709)

Fixes : #20617

### Motivation

Currently, clients' shutdown API does not behave consistently in sense that 
asynchronicity is not handled explicitly. So issue #20617 happens.

This PR will allow clients know that shutdown is actually triggered.

### Modifications

- Synchronize call to `POST /shutdown` on client side
- Asynchronize explicitly `pulsar().closeAsync()` invocation
---
 .../pulsar/broker/admin/impl/BrokersBase.java  | 20 +
 .../org/apache/pulsar/client/admin/Brokers.java|  9 +++---
 .../java/org/apache/pulsar/admin/cli/CmdBase.java  | 34 ++
 .../org/apache/pulsar/admin/cli/CmdBrokers.java|  4 +--
 4 files changed, 56 insertions(+), 11 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
index b367ce7aad9..be8390f15f8 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
@@ -545,16 +545,26 @@ public class BrokersBase extends AdminResource {
 @ApiParam(name = "maxConcurrentUnloadPerSec",
 value = "if the value absent(value=0) means no concurrent 
limitation.")
 @QueryParam("maxConcurrentUnloadPerSec") int 
maxConcurrentUnloadPerSec,
-@QueryParam("forcedTerminateTopic") @DefaultValue("true") boolean 
forcedTerminateTopic
+@QueryParam("forcedTerminateTopic") @DefaultValue("true") boolean 
forcedTerminateTopic,
+@Suspended final AsyncResponse asyncResponse
 ) {
 validateSuperUserAccess();
-doShutDownBrokerGracefully(maxConcurrentUnloadPerSec, 
forcedTerminateTopic);
+doShutDownBrokerGracefullyAsync(maxConcurrentUnloadPerSec, 
forcedTerminateTopic)
+.thenAccept(__ -> {
+LOG.info("[{}] Successfully shutdown broker gracefully", 
clientAppId());
+asyncResponse.resume(Response.noContent().build());
+})
+.exceptionally(ex -> {
+LOG.error("[{}] Failed to shutdown broker gracefully", 
clientAppId(), ex);
+resumeAsyncResponseExceptionally(asyncResponse, ex);
+return null;
+});
 }
 
-private void doShutDownBrokerGracefully(int maxConcurrentUnloadPerSec,
-boolean forcedTerminateTopic) {
+private CompletableFuture doShutDownBrokerGracefullyAsync(int 
maxConcurrentUnloadPerSec,
+boolean 
forcedTerminateTopic) {
 
pulsar().getBrokerService().unloadNamespaceBundlesGracefully(maxConcurrentUnloadPerSec,
 forcedTerminateTopic);
-pulsar().closeAsync();
+return pulsar().closeAsync();
 }
 }
 
diff --git 
a/pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Brokers.java
 
b/pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Brokers.java
index 464d02121cf..29c280f8ba5 100644
--- 
a/pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Brokers.java
+++ 
b/pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Brokers.java
@@ -326,10 +326,11 @@ public interface Brokers {
 CompletableFuture healthcheckAsync(TopicVersion topicVersion);
 
 /**
- * Shutdown current broker gracefully.
- * @param maxConcurrentUnloadPerSec
- * @param forcedTerminateTopic
- * @return
+ * Trigger the current broker to graceful-shutdown asynchronously.
+ *
+ * @param maxConcurrentUnloadPerSec the maximum number of topics to unload 
per second.
+ *  This helps control the speed of the 
unload operation during shutdown.
+ * @param forcedTerminateTopic if true, topics will be forcefully 
terminated during the shutdown process.
  */
 CompletableFuture shutDownBrokerGracefully(int 
maxConcurrentUnloadPerSec,
  boolean 
forcedTerminateTopic);
diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdBase.java

[pulsar] branch 2.10.3.3 created (now e0b50c9ec5f)

2023-02-20 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch 2.10.3.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git


  at e0b50c9ec5f [fix][client] Logger.warn usage bug fix: the number is 
inconsistent for format and arguments (#19562)

No new revisions were added by this update.



[pulsar] branch branch-2.9 updated: [fix][broker]Update interceptor handler exception (#18940)

2022-12-18 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 304b506f294 [fix][broker]Update interceptor handler exception (#18940)
304b506f294 is described below

commit 304b506f294c3b099d985b65725036c449aae9cd
Author: Guangning E 
AuthorDate: Mon Dec 19 14:10:28 2022 +0800

[fix][broker]Update interceptor handler exception (#18940)

(cherry picked from commit e07b67fd8c5c5cc0fd41ca0c0d956b0cb514c96e)
---
 .../apache/pulsar/broker/web/ExceptionHandler.java | 27 +--
 .../broker/intercept/BrokerInterceptorTest.java| 30 ++
 .../broker/intercept/CounterBrokerInterceptor.java | 20 ---
 3 files changed, 66 insertions(+), 11 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
index 8b200a8b9f6..b70168853a7 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
@@ -25,6 +25,11 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.Response;
 import org.apache.pulsar.common.intercept.InterceptException;
+import org.apache.pulsar.common.policies.data.ErrorData;
+import org.apache.pulsar.common.util.ObjectMapperFactory;
+import org.eclipse.jetty.http.HttpField;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpVersion;
 import org.eclipse.jetty.http.MetaData;
 
@@ -35,16 +40,22 @@ public class ExceptionHandler {
 
 public void handle(ServletResponse response, Exception ex) throws 
IOException {
 if (ex instanceof InterceptException) {
-String reason = ex.getMessage();
-byte[] content = reason.getBytes(StandardCharsets.UTF_8);
-MetaData.Response info = new MetaData.Response();
-info.setHttpVersion(HttpVersion.HTTP_1_1);
-info.setReason(reason);
-info.setStatus(((InterceptException) ex).getErrorCode());
-info.setContentLength(content.length);
 if (response instanceof org.eclipse.jetty.server.Response) {
+String errorData = ObjectMapperFactory
+.getThreadLocal().writeValueAsString(new 
ErrorData(ex.getMessage()));
+byte[] errorBytes = errorData.getBytes(StandardCharsets.UTF_8);
+int errorCode = ((InterceptException) ex).getErrorCode();
+HttpFields httpFields = new HttpFields();
+HttpField httpField = new HttpField(HttpHeader.CONTENT_TYPE, 
"application/json;charset=utf-8");
+httpFields.add(httpField);
+MetaData.Response info = new 
MetaData.Response(HttpVersion.HTTP_1_1, errorCode, httpFields);
+info.setHttpVersion(HttpVersion.HTTP_1_1);
+info.setReason(errorData);
+info.setStatus(errorCode);
+info.setContentLength(errorBytes.length);
 ((org.eclipse.jetty.server.Response) 
response).getHttpChannel().sendResponse(info,
-ByteBuffer.wrap(content), true);
+ByteBuffer.wrap(errorBytes),
+true);
 } else {
 ((HttpServletResponse) 
response).sendError(((InterceptException) ex).getErrorCode(),
 ex.getMessage());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index 0e46b147e7b..37c0f8fddc1 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.common.nar.NarClassLoader;
+import org.apache.pulsar.common.policies.data.TenantInfoImpl;
 import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -40,7 +41,9 @@ import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 
 import static org.mockito.ArgumentMatchers.same;
@@ -209,8 +212,35 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
 Awaitility.awa

[pulsar] branch branch-2.10 updated: [fix][broker]Update interceptor handler exception (#18940)

2022-12-18 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch-2.10 by this push:
 new ad9c133a5de [fix][broker]Update interceptor handler exception (#18940)
ad9c133a5de is described below

commit ad9c133a5ded46c9adad099ea77630cdec8bb9bf
Author: Guangning E 
AuthorDate: Mon Dec 19 14:10:28 2022 +0800

[fix][broker]Update interceptor handler exception (#18940)

(cherry picked from commit e07b67fd8c5c5cc0fd41ca0c0d956b0cb514c96e)
---
 .../apache/pulsar/broker/web/ExceptionHandler.java | 27 +--
 .../broker/intercept/BrokerInterceptorTest.java| 30 ++
 .../broker/intercept/CounterBrokerInterceptor.java | 20 ---
 3 files changed, 66 insertions(+), 11 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
index 8b200a8b9f6..b70168853a7 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
@@ -25,6 +25,11 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.Response;
 import org.apache.pulsar.common.intercept.InterceptException;
+import org.apache.pulsar.common.policies.data.ErrorData;
+import org.apache.pulsar.common.util.ObjectMapperFactory;
+import org.eclipse.jetty.http.HttpField;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpVersion;
 import org.eclipse.jetty.http.MetaData;
 
@@ -35,16 +40,22 @@ public class ExceptionHandler {
 
 public void handle(ServletResponse response, Exception ex) throws 
IOException {
 if (ex instanceof InterceptException) {
-String reason = ex.getMessage();
-byte[] content = reason.getBytes(StandardCharsets.UTF_8);
-MetaData.Response info = new MetaData.Response();
-info.setHttpVersion(HttpVersion.HTTP_1_1);
-info.setReason(reason);
-info.setStatus(((InterceptException) ex).getErrorCode());
-info.setContentLength(content.length);
 if (response instanceof org.eclipse.jetty.server.Response) {
+String errorData = ObjectMapperFactory
+.getThreadLocal().writeValueAsString(new 
ErrorData(ex.getMessage()));
+byte[] errorBytes = errorData.getBytes(StandardCharsets.UTF_8);
+int errorCode = ((InterceptException) ex).getErrorCode();
+HttpFields httpFields = new HttpFields();
+HttpField httpField = new HttpField(HttpHeader.CONTENT_TYPE, 
"application/json;charset=utf-8");
+httpFields.add(httpField);
+MetaData.Response info = new 
MetaData.Response(HttpVersion.HTTP_1_1, errorCode, httpFields);
+info.setHttpVersion(HttpVersion.HTTP_1_1);
+info.setReason(errorData);
+info.setStatus(errorCode);
+info.setContentLength(errorBytes.length);
 ((org.eclipse.jetty.server.Response) 
response).getHttpChannel().sendResponse(info,
-ByteBuffer.wrap(content), true);
+ByteBuffer.wrap(errorBytes),
+true);
 } else {
 ((HttpServletResponse) 
response).sendError(((InterceptException) ex).getErrorCode(),
 ex.getMessage());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index 0e46b147e7b..37c0f8fddc1 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.common.nar.NarClassLoader;
+import org.apache.pulsar.common.policies.data.TenantInfoImpl;
 import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -40,7 +41,9 @@ import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 
 import static org.mockito.ArgumentMatchers.same;
@@ -209,8 +212,35 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
 Awaitility.awa

[pulsar] branch branch-2.11 updated: [fix][broker]Update interceptor handler exception (#18940)

2022-12-18 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 7c63e92b1dd [fix][broker]Update interceptor handler exception (#18940)
7c63e92b1dd is described below

commit 7c63e92b1dd70ac269dc4b0d9ef10aafd83132c1
Author: Guangning E 
AuthorDate: Mon Dec 19 14:10:28 2022 +0800

[fix][broker]Update interceptor handler exception (#18940)

(cherry picked from commit e07b67fd8c5c5cc0fd41ca0c0d956b0cb514c96e)
---
 .../apache/pulsar/broker/web/ExceptionHandler.java | 27 +--
 .../broker/intercept/BrokerInterceptorTest.java| 30 ++
 .../broker/intercept/CounterBrokerInterceptor.java | 20 ---
 3 files changed, 66 insertions(+), 11 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
index 8b200a8b9f6..b70168853a7 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
@@ -25,6 +25,11 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.Response;
 import org.apache.pulsar.common.intercept.InterceptException;
+import org.apache.pulsar.common.policies.data.ErrorData;
+import org.apache.pulsar.common.util.ObjectMapperFactory;
+import org.eclipse.jetty.http.HttpField;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpVersion;
 import org.eclipse.jetty.http.MetaData;
 
@@ -35,16 +40,22 @@ public class ExceptionHandler {
 
 public void handle(ServletResponse response, Exception ex) throws 
IOException {
 if (ex instanceof InterceptException) {
-String reason = ex.getMessage();
-byte[] content = reason.getBytes(StandardCharsets.UTF_8);
-MetaData.Response info = new MetaData.Response();
-info.setHttpVersion(HttpVersion.HTTP_1_1);
-info.setReason(reason);
-info.setStatus(((InterceptException) ex).getErrorCode());
-info.setContentLength(content.length);
 if (response instanceof org.eclipse.jetty.server.Response) {
+String errorData = ObjectMapperFactory
+.getThreadLocal().writeValueAsString(new 
ErrorData(ex.getMessage()));
+byte[] errorBytes = errorData.getBytes(StandardCharsets.UTF_8);
+int errorCode = ((InterceptException) ex).getErrorCode();
+HttpFields httpFields = new HttpFields();
+HttpField httpField = new HttpField(HttpHeader.CONTENT_TYPE, 
"application/json;charset=utf-8");
+httpFields.add(httpField);
+MetaData.Response info = new 
MetaData.Response(HttpVersion.HTTP_1_1, errorCode, httpFields);
+info.setHttpVersion(HttpVersion.HTTP_1_1);
+info.setReason(errorData);
+info.setStatus(errorCode);
+info.setContentLength(errorBytes.length);
 ((org.eclipse.jetty.server.Response) 
response).getHttpChannel().sendResponse(info,
-ByteBuffer.wrap(content), true);
+ByteBuffer.wrap(errorBytes),
+true);
 } else {
 ((HttpServletResponse) 
response).sendError(((InterceptException) ex).getErrorCode(),
 ex.getMessage());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index b2c3b8d711f..a2cff248f9f 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.common.nar.NarClassLoader;
+import org.apache.pulsar.common.policies.data.TenantInfoImpl;
 import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -40,7 +41,9 @@ import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 
@@ -228,8 +231,35 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
 Awaitility.await().until(() -> 
!interceptor.ge

[pulsar] branch master updated: [fix][broker]Update interceptor handler exception (#18940)

2022-12-18 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 e07b67fd8c5 [fix][broker]Update interceptor handler exception (#18940)
e07b67fd8c5 is described below

commit e07b67fd8c5c5cc0fd41ca0c0d956b0cb514c96e
Author: Guangning E 
AuthorDate: Mon Dec 19 14:10:28 2022 +0800

[fix][broker]Update interceptor handler exception (#18940)
---
 .../apache/pulsar/broker/web/ExceptionHandler.java | 27 +--
 .../broker/intercept/BrokerInterceptorTest.java| 30 ++
 .../broker/intercept/CounterBrokerInterceptor.java | 20 ---
 3 files changed, 66 insertions(+), 11 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
index 16eda7fc58c..aed6fbdc10c 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/ExceptionHandler.java
@@ -25,6 +25,11 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.Response;
 import org.apache.pulsar.common.intercept.InterceptException;
+import org.apache.pulsar.common.policies.data.ErrorData;
+import org.apache.pulsar.common.util.ObjectMapperFactory;
+import org.eclipse.jetty.http.HttpField;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpVersion;
 import org.eclipse.jetty.http.MetaData;
 
@@ -35,16 +40,22 @@ public class ExceptionHandler {
 
 public void handle(ServletResponse response, Exception ex) throws 
IOException {
 if (ex instanceof InterceptException) {
-String reason = ex.getMessage();
-byte[] content = reason.getBytes(StandardCharsets.UTF_8);
-MetaData.Response info = new MetaData.Response();
-info.setHttpVersion(HttpVersion.HTTP_1_1);
-info.setReason(reason);
-info.setStatus(((InterceptException) ex).getErrorCode());
-info.setContentLength(content.length);
 if (response instanceof org.eclipse.jetty.server.Response) {
+String errorData = ObjectMapperFactory
+.getThreadLocal().writeValueAsString(new 
ErrorData(ex.getMessage()));
+byte[] errorBytes = errorData.getBytes(StandardCharsets.UTF_8);
+int errorCode = ((InterceptException) ex).getErrorCode();
+HttpFields httpFields = new HttpFields();
+HttpField httpField = new HttpField(HttpHeader.CONTENT_TYPE, 
"application/json;charset=utf-8");
+httpFields.add(httpField);
+MetaData.Response info = new 
MetaData.Response(HttpVersion.HTTP_1_1, errorCode, httpFields);
+info.setHttpVersion(HttpVersion.HTTP_1_1);
+info.setReason(errorData);
+info.setStatus(errorCode);
+info.setContentLength(errorBytes.length);
 ((org.eclipse.jetty.server.Response) 
response).getHttpChannel().sendResponse(info,
-ByteBuffer.wrap(content), true);
+ByteBuffer.wrap(errorBytes),
+true);
 } else {
 ((HttpServletResponse) 
response).sendError(((InterceptException) ex).getErrorCode(),
 ex.getMessage());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index 4b12fbdf1f4..bc6cc6fc5be 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.common.nar.NarClassLoader;
+import org.apache.pulsar.common.policies.data.TenantInfoImpl;
 import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -40,7 +41,9 @@ import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 
@@ -269,8 +272,35 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
 Awaitility.await().until(() -> 
!interceptor.getResponseList().isEmpty());
 CounterBrokerInterceptor.ResponseEvent 

[pulsar] branch master updated (a95154976eb -> 1107af24932)

2022-12-15 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from a95154976eb [fix][io] Only bundle kafka schema registry client (#18931)
 add 1107af24932 [fix][client] Fix update response body text (#18794)

No new revisions were added by this update.

Summary of changes:
 .../test/java/org/apache/pulsar/broker/admin/AdminApiSchemaTest.java   | 2 +-
 .../apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)



[pulsar-site] 01/01: Revert this darh light switch mode

2022-11-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch fixed/revert-dark-light-mode
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit 13c6b61d2be242eb4eb68651d64b8f9baf2e5fa1
Author: guangning 
AuthorDate: Wed Nov 9 14:54:35 2022 +0800

Revert this darh light switch mode
---
 site2/website-next/docusaurus.config.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/site2/website-next/docusaurus.config.js 
b/site2/website-next/docusaurus.config.js
index 2f67001d16c..c076965efa1 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -147,7 +147,7 @@ module.exports = {
   isCloseable: true,
 },
 colorMode: {
-  disableSwitch: true,
+  disableSwitch: false,
 },
 navbar: {
   title: "",



[pulsar-site] branch fixed/revert-dark-light-mode created (now 13c6b61d2be)

2022-11-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch fixed/revert-dark-light-mode
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


  at 13c6b61d2be Revert this darh light switch mode

This branch includes the following new commits:

 new 13c6b61d2be Revert this darh light switch mode

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[pulsar-site] branch main updated: Remove disableSwitch (#277)

2022-11-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
 new 6a0acacc6cd Remove disableSwitch (#277)
6a0acacc6cd is described below

commit 6a0acacc6cd346c3426fb9faafd3d74447d4a67b
Author: Yan 
AuthorDate: Wed Nov 9 10:26:05 2022 +0800

Remove disableSwitch (#277)

Co-authored-by: Yan Zhang 
---
 site2/website-next/docusaurus.config.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/site2/website-next/docusaurus.config.js 
b/site2/website-next/docusaurus.config.js
index c076965efa1..2f67001d16c 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -147,7 +147,7 @@ module.exports = {
   isCloseable: true,
 },
 colorMode: {
-  disableSwitch: false,
+  disableSwitch: true,
 },
 navbar: {
   title: "",



[pulsar] branch master updated: Update proxy lookup throw exception type (#17600)

2022-09-13 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 52a380f7e93 Update proxy lookup throw exception type (#17600)
52a380f7e93 is described below

commit 52a380f7e930e633dcefcbdb29ee1460e867dcfe
Author: Guangning E 
AuthorDate: Wed Sep 14 09:47:28 2022 +0800

Update proxy lookup throw exception type (#17600)
---
 .../org/apache/pulsar/proxy/server/LookupProxyHandler.java | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
index 1532b5c0f52..472de4327f9 100644
--- 
a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
+++ 
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
@@ -151,7 +151,7 @@ public class LookupProxyHandler {
 if (t != null) {
 log.warn("[{}] Failed to lookup topic {}: {}", 
clientAddress, topic, t.getMessage());
 proxyConnection.ctx().writeAndFlush(
-
Commands.newLookupErrorResponse(ServerError.ServiceNotReady, t.getMessage(), 
clientRequestId));
+Commands.newLookupErrorResponse(getServerError(t), 
t.getMessage(), clientRequestId));
 } else {
 String brokerUrl = connectWithTLS ? r.brokerUrlTls : 
r.brokerUrl;
 if (r.redirect) {
@@ -179,7 +179,7 @@ public class LookupProxyHandler {
 }).exceptionally(ex -> {
 // Failed to connect to backend broker
 proxyConnection.ctx().writeAndFlush(
-
Commands.newLookupErrorResponse(ServerError.ServiceNotReady, ex.getMessage(), 
clientRequestId));
+Commands.newLookupErrorResponse(getServerError(ex), 
ex.getMessage(), clientRequestId));
 return null;
 });
 }
@@ -249,7 +249,7 @@ public class LookupProxyHandler {
 });
 }).exceptionally(ex -> {
 // Failed to connect to backend broker
-
proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(ServerError.ServiceNotReady,
+
proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(getServerError(ex),
 ex.getMessage(), clientRequestId));
 return null;
 });
@@ -330,7 +330,7 @@ public class LookupProxyHandler {
 log.warn("[{}] Failed to get TopicsOfNamespace {}: {}",
 clientAddress, namespaceName, t.getMessage());
 proxyConnection.ctx().writeAndFlush(
-Commands.newError(clientRequestId, 
ServerError.ServiceNotReady, t.getMessage()));
+Commands.newError(clientRequestId, getServerError(t), 
t.getMessage()));
 } else {
 proxyConnection.ctx().writeAndFlush(
 
Commands.newGetTopicsOfNamespaceResponse(r.getTopics(), r.getTopicsHash(), 
r.isFiltered(),
@@ -342,7 +342,7 @@ public class LookupProxyHandler {
 }).exceptionally(ex -> {
 // Failed to connect to backend broker
 proxyConnection.ctx().writeAndFlush(
-Commands.newError(clientRequestId, 
ServerError.ServiceNotReady, ex.getMessage()));
+Commands.newError(clientRequestId, getServerError(ex), 
ex.getMessage()));
 return null;
 });
 }
@@ -385,7 +385,7 @@ public class LookupProxyHandler {
 if (t != null) {
 log.warn("[{}] Failed to get schema {}: {}", 
clientAddress, topic, t);
 proxyConnection.ctx().writeAndFlush(
-Commands.newError(clientRequestId, 
ServerError.ServiceNotReady, t.getMessage()));
+Commands.newError(clientRequestId, getServerError(t), 
t.getMessage()));
 } else {
 proxyConnection.ctx().writeAndFlush(
 Commands.newGetSchemaResponse(clientRequestId, r));
@@ -396,7 +396,7 @@ public class LookupProxyHandler {
 }).exceptionally(ex -> {
 // Failed to connect to backend broker
 proxyConnection.ctx().writeAndFlush(
-Commands.newError(clientRequestId, 
ServerError.ServiceNotReady, ex.getMessage()));
+Commands.newError(clientRequestId, getServerError(ex), 
ex.getMessage()));
 return null;
 });
 



[pulsar-manager] branch master updated: Move version to 0.3.0 (#455)

2022-06-14 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 91e2a1f  Move version to 0.3.0 (#455)
91e2a1f is described below

commit 91e2a1f0f37b0b19201801fb0463a8ac6714f7b4
Author: Li Li 
AuthorDate: Tue Jun 14 16:09:18 2022 +0800

Move version to 0.3.0 (#455)

Signed-off-by: Li Li 
---
 front-end/package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/front-end/package.json b/front-end/package.json
index 744543f..fc8e80e 100644
--- a/front-end/package.json
+++ b/front-end/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pulsar-manager",
-  "version": "0.2.0",
+  "version": "0.3.0",
   "description": "A tool for managing Apache Pulsar.",
   "author": "",
   "license": "Apache License 2.0",



[pulsar] branch master updated: [feature][website] add blog - whats new in pulsar 2.10 (#15553)

2022-05-12 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 26fe3a683c5 [feature][website] add blog - whats new in pulsar 2.10 
(#15553)
26fe3a683c5 is described below

commit 26fe3a683c50c44712089a54cd41936eebd912df
Author: Li Li 
AuthorDate: Thu May 12 16:27:14 2022 +0800

[feature][website] add blog - whats new in pulsar 2.10 (#15553)

* [feature][website] add blog - whats new in plusar 2.10

Signed-off-by: Li Li 

* update

Signed-off-by: Li Li 

* update

Signed-off-by: Li Li 
---
 ...-pulsar-community-welcomes-500th-contributor.md |   2 +-
 .../blog/2022-05-11-whats-new-in-pulsar-210.md | 177 +
 2 files changed, 178 insertions(+), 1 deletion(-)

diff --git 
a/site2/website/blog/2022-05-11-apache-pulsar-community-welcomes-500th-contributor.md
 
b/site2/website/blog/2022-05-11-apache-pulsar-community-welcomes-500th-contributor.md
index b8ad6d899b8..b283591720c 100644
--- 
a/site2/website/blog/2022-05-11-apache-pulsar-community-welcomes-500th-contributor.md
+++ 
b/site2/website/blog/2022-05-11-apache-pulsar-community-welcomes-500th-contributor.md
@@ -1,7 +1,7 @@
 ---
 title: "The Apache Pulsar Community Welcomes 500th Contributor!"
 date: 2022-05-11
-author: "Matteo Merli", "Karin Landers", "Alice Bi"
+author: "Matteo Merli, Karin Landers, Alice Bi"
 ---
 
 
diff --git a/site2/website/blog/2022-05-11-whats-new-in-pulsar-210.md 
b/site2/website/blog/2022-05-11-whats-new-in-pulsar-210.md
new file mode 100644
index 000..7610241ab41
--- /dev/null
+++ b/site2/website/blog/2022-05-11-whats-new-in-pulsar-210.md
@@ -0,0 +1,177 @@
+---
+title: "What’s New in Apache Pulsar 2.10"
+date: 2022-05-11
+author: "Penghui Li, Dave Duggins"
+---
+
+The Apache Pulsar community releases version 2.10. 99 contributors provided 
improvements and bug fixes that delivered over 800 commits.
+
+
+
+# Highlights of this release:
+
+- Pulsar provides automatic failure recovery between the primary and backup 
clusters. #13316
+  - Original PIP 
[#13315](https://www.google.com/url?q=https://github.com/apache/pulsar/issues/13315=D=docs=1646058957138073=AOvVaw3mGki2sHW2QpIsoYf5pt3w)
+- Fewer producers needed and more efficient use of broker memory with 
lazy-loading feature added to `PartitionedProducer`. #10279
+- Topic map support added with new `TableView` type using key values in 
received messages.
+
+This blog documents the most noteworthy changes in this release. For the 
complete list including all features, enhancements, and bug fixes, check out 
the [Pulsar 2.10.1 Release 
Notes](https://pulsar.apache.org/release-notes/#placeholder).
+
+# Notable bug fixes and enhancements
+***
+ Cluster
+***
+
+# Pulsar cluster level auto failover on client side #13316
+
+**Issue:** A Pulsar administrator must manually failover a cluster.
+
+**Resolution:** Added Pulsar cluster-level auto-failover, which automatically 
and seamlessly switches from primary to one or more secondary clusters when a 
failover event is detected. When the primary cluster recovers, the client 
automatically switches back.
+
+# Topic policy across multiple clusters #12517
+
+**Issue:** Some topic policies for a geo-replicated cluster affect the entire 
geo-replicated cluster while some only affect the local cluster. 
+
+**Resolution:** Topic policies now support cross-cluster replication. 
+- For local topic policies, set the `replicateTo` property of the message to 
avoid being replicated to the remote.
+- Retention supports setting global parameters.
+- Added global topic policies for `SystemTopicBasedTopicPoliciesService`. 
+
+***
+ Producer
+***
+
+# Add lazy-loading feature to PartitionedProducer #10279
+
+**Issue:** With the number of partitions set according to the highest rate 
producer, the lowest rate producer does not always need to connect to every 
partition, so extra producers take up broker memory.
+
+**Resolution:** Reduced the number of producers to use broker memory more 
efficiently by introducing lazy-loading for partitioned producers; also added 
round-robin routing mode class to limit the number of partitions.
+
+# [Client] Introduce chunk message ID #12403
+
+**Issue:** When sending chunked messages, the producer returns the message-id 
of the last chunk, causing incorrect behaviors in some processes.
+
+**Resolution:** Introduced the new `ChunkMessage-ID` type. The chunk 
message-id inherits from ``MessageIdImpl`` and adds two new methods: 
``getFirstChunkMessageId`` and ``getLastChunkMessageID``. For other method 
implementations, the ``lastChunkMessageID`` is called directly, which is 
compatible with much of the existing business logic. 
+
+***
+ Broker
+***
+
+# 

[pulsar-manager] branch master updated: Add support for casdoor (#446)

2022-04-12 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4ab8811  Add support for casdoor (#446)
4ab8811 is described below

commit 4ab8811a48ce7d2c8148f765f9cd9b62fbb76bfb
Author: Fabian Bao 
AuthorDate: Wed Apr 13 09:54:09 2022 +0800

Add support for casdoor (#446)

feet: add support for casdoor
---
 build.gradle   |  1 +
 front-end/package.json |  4 +--
 front-end/src/api/login.js | 13 +
 front-end/src/lang/en.js   |  1 +
 front-end/src/lang/zh.js   |  1 +
 front-end/src/permission.js|  2 +-
 front-end/src/router/index.js  |  7 -
 front-end/src/store/modules/user.js| 18 
 front-end/src/views/callback/index.vue | 18 
 front-end/src/views/login/index.vue| 13 +++--
 .../pulsar/manager/controller/LoginController.java | 34 ++
 .../manager/interceptor/WebAppConfigurer.java  |  1 +
 src/main/resources/application.properties  | 12 ++--
 13 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/build.gradle b/build.gradle
index 0ccab9c..9a9dc9b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -148,6 +148,7 @@ dependencies {
 compile group: 'org.glassfish.jersey.media', name: 
'jersey-media-json-jackson', version: jerseyVersion
 compile group: 'org.springframework.boot', name: 
'spring-boot-starter-security'
 compile group: 'org.springframework.security', name: 
'spring-security-config'
+compile group: 'org.casbin', name: 'casdoor-spring-boot-starter', version: 
'1.2.0'
 compileOnly group: 'org.projectlombok', name: 'lombok', version: 
lombokVersion
 compileOnly group: 'org.springframework.boot', name: 
'spring-boot-devtools', version: springBootVersion
 testCompile group: 'org.springframework.boot', name: 
'spring-boot-starter-test', version: springBootVersion
diff --git a/front-end/package.json b/front-end/package.json
index 64225d6..eca0935 100644
--- a/front-end/package.json
+++ b/front-end/package.json
@@ -5,7 +5,7 @@
   "author": "",
   "license": "Apache License 2.0",
   "scripts": {
-"dev": "cross-env BABEL_ENV=development webpack-dev-server --inline 
--progress --config build/webpack.dev.conf.js",
+"dev": "cross-env BABEL_ENV=development 
NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --inline --progress 
--config build/webpack.dev.conf.js",
 "build:prod": "cross-env NODE_ENV=production env_config=prod node 
build/build.js",
 "build:sit": "cross-env NODE_ENV=production env_config=sit node 
build/build.js",
 "lint": "eslint --ext .js,.vue src",
@@ -35,6 +35,7 @@
   },
   "dependencies": {
 "axios": "0.18.1",
+"casdoor-js-sdk": "^0.2.5",
 "clipboard": "1.7.1",
 "codemirror": "5.39.2",
 "connect": "3.6.6",
@@ -97,7 +98,6 @@
 "request": "^2.88.0",
 "rimraf": "2.6.2",
 "sass-loader": "7.0.3",
-"script-ext-html-webpack-plugin": "2.0.1",
 "script-loader": "0.7.2",
 "semver": "5.5.0",
 "serve-static": "1.13.2",
diff --git a/front-end/src/api/login.js b/front-end/src/api/login.js
index 0c3ca2e..7bfc6f4 100644
--- a/front-end/src/api/login.js
+++ b/front-end/src/api/login.js
@@ -26,6 +26,19 @@ export function loginByUsername(username, password) {
   })
 }
 
+export function loginByCasdoor(code, state) {
+  const data = {
+code,
+state
+  }
+  return request({
+headers: { 'Content-Type': 'application/json' },
+url: '/pulsar-manager/casdoor',
+method: 'post',
+data
+  })
+}
+
 export function logout() {
   return request({
 url: '/pulsar-manager/logout',
diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index 6e359da..1161a62 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -104,6 +104,7 @@ export default {
 username: 'Username',
 password: 'Password',
 any: 'any',
+casdoor: 'Login with casdoor',
 thirdparty: 'Or connect with',
 thirdpartyTips: 'Can not be simulated on local, so please combine you own 
business simulation! ! !'
   },
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index d466f8b..610d2ba 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -104,6 +104,7 @@ export

[pulsar-manager] branch master updated: Simplified classpath (#444)

2022-04-12 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 5a250d2  Simplified classpath (#444)
5a250d2 is described below

commit 5a250d25f7ba160a69f5c968d758e8fae3c2d9a8
Author: xuesongxs <54351417+xueson...@users.noreply.github.com>
AuthorDate: Tue Apr 12 14:12:46 2022 +0800

Simplified classpath (#444)
---
 build.gradle | 4 
 1 file changed, 4 insertions(+)

diff --git a/build.gradle b/build.gradle
index b629cba..0ccab9c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -55,6 +55,10 @@ apply plugin: 'application'
 
 mainClassName = 'org.apache.pulsar.manager.PulsarManagerApplication'
 
+startScripts {
+classpath  = files('$APP_HOME/lib/*')
+}
+
 task licenseFormatNode(type: 
com.hierynomus.gradle.license.tasks.LicenseFormat) {
 source = fileTree(dir: "src").include("**/*")
 source = fileTree(dir: "front-end/src").include("**/*")



[pulsar-manager] branch master updated: fix: node engines limit and close eslint (#448)

2022-04-12 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4b07b24  fix: node engines limit and close eslint (#448)
4b07b24 is described below

commit 4b07b249b5a12cdbb08055d0e99bb99b42696e64
Author: Li Li 
AuthorDate: Tue Apr 12 14:12:24 2022 +0800

fix: node engines limit and close eslint (#448)

Signed-off-by: LiLi 
---
 front-end/.eslintignore | 1 +
 front-end/package.json  | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/front-end/.eslintignore b/front-end/.eslintignore
index e3a4037..abe3a67 100644
--- a/front-end/.eslintignore
+++ b/front-end/.eslintignore
@@ -1,3 +1,4 @@
 build/*.js
 config/*.js
 src/assets
+src/
\ No newline at end of file
diff --git a/front-end/package.json b/front-end/package.json
index 8094bf1..64225d6 100644
--- a/front-end/package.json
+++ b/front-end/package.json
@@ -115,8 +115,7 @@
 "webpack-merge": "4.1.4"
   },
   "engines": {
-"node": ">= 6.0.0",
-"npm": ">= 3.0.0"
+"node": ">=12.0.0 <=12.22.10"
   },
   "browserslist": [
 "> 1%",



[pulsar-client-node] annotated tag v1.6.2 updated (1636455 -> ab3b1dc)

2022-03-10 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to annotated tag v1.6.2
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git.


*** WARNING: tag v1.6.2 was modified! ***

from 1636455  (commit)
  to ab3b1dc  (tag)
 tagging 163645536d057ac045471f368d5228f805252aa5 (commit)
 replaces v1.6.0-rc.2
  by guangning
  on Thu Mar 10 21:24:51 2022 +0800

- Log -
Release v1.6.2
---


No new revisions were added by this update.

Summary of changes:


svn commit: r52899 - in /dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1: ./ pulsar-client-node-1.6.2.tar.gz pulsar-client-node-1.6.2.tar.gz.asc pulsar-client-node-1.6.2.tar.gz.sha5

2022-03-07 Thread guangning
Author: guangning
Date: Mon Mar  7 10:21:39 2022
New Revision: 52899

Log:
Staging artifacts and signature for Pulsar Node.js client release 
1.6.2-candidate-1

Added:
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz
   (with props)

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.asc

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.sha512

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz
==
Binary file - no diff available.

Propchange: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz
--
svn:mime-type = application/octet-stream

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.asc
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.asc
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.asc
 Mon Mar  7 10:21:39 2022
@@ -0,0 +1,11 @@
+-BEGIN PGP SIGNATURE-
+
+iQEzBAABCAAdFiEEfLgyKwIZSFWNsgIYV3wHyoZ66RAFAmIl3IsACgkQV3wHyoZ6
+6RB9FAf8C/rjzFWJhWchKmhEBdSh0HNm9fAfYjcuRTAL/SUg5rCyQpgIDeIqbSpV
+eNZS3X9YaX+rRxl+nEjggESoyfJnaklrl7cG+XCRYPzPcnXWZRJnZ29mREOGq7e2
+cumffX0gvJJ9oDWoah8SwxRDjCsfYSppWmPx1y/CPH66ohYfCwelVbHDpEU+7bR/
+VqcAG1+Axh9vi4cZoyPgnkaFQK1hi9+U3Kb0eYCoQizfmkorfJX3Us+7vuKoM1ei
+fJFe+QZTl6Igouual6+MWQFw0aMUfD7VJjqp0G6XJ9MC5HZBgFM4ayqx0XCrTV+q
+F35LS28dTIVoz4A4/O3Is2dncbTwwg==
+=0YhW
+-END PGP SIGNATURE-

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.sha512
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.sha512
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.2-candidate-1/pulsar-client-node-1.6.2.tar.gz.sha512
 Mon Mar  7 10:21:39 2022
@@ -0,0 +1 @@
+9fa23565c247040c43ba363ae19e0c2b3e6f88dc3b26553b5e41262085b51d55ff357d6d7006ea1f3a714ab3b53107b42b8b8ac8ddf01f9f77f2bd1143aef93d
  pulsar-client-node-1.6.2.tar.gz




svn commit: r52775 - in /dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2: ./ pulsar-client-node-1.6.0.tar.gz pulsar-client-node-1.6.0.tar.gz.asc pulsar-client-node-1.6.0.tar.gz.sha5

2022-02-28 Thread guangning
Author: guangning
Date: Mon Feb 28 13:11:18 2022
New Revision: 52775

Log:
Staging artifacts and signature for Pulsar Node.js client release 
1.6.0-candidate-2

Added:
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz
   (with props)

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.asc

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.sha512

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz
==
Binary file - no diff available.

Propchange: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz
--
svn:mime-type = application/octet-stream

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.asc
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.asc
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.asc
 Mon Feb 28 13:11:18 2022
@@ -0,0 +1,11 @@
+-BEGIN PGP SIGNATURE-
+
+iQEzBAABCAAdFiEEfLgyKwIZSFWNsgIYV3wHyoZ66RAFAmIcyYUACgkQV3wHyoZ6
+6RDOUwgAgP1OHJxlea1NCSe2eGqx1V4wLhE5biw4ccn7deMCklNBYB+jNQGj1ArN
+vlgl/Lf80rFgBhF9eEiXiDXK+O8VrXmKwTwuuI/iWRLFm5lG7Hsw8tvjNA5ST0E+
+EXwDewdzsBuNP2DLE/rEyqOQlKlRmzYt5xXk7QSLOc8YOIw/AlftOp1mthQTbRYw
+aCiMfKNSeKHZJlMi9c/BQA8sFAgV7PLFyMgwJdSXool38YF0fYB1oINJC7eMogPx
+WkflEx7PvAkdeNJ4Oghg9H/AaHrYINexKnDow7XO7Ts6ax5HGWA//7Dk/0fSl3gf
+Ana9iRTZktn/1yZjSie2F3uP+/92lg==
+=6Qzs
+-END PGP SIGNATURE-

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.sha512
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.sha512
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-2/pulsar-client-node-1.6.0.tar.gz.sha512
 Mon Feb 28 13:11:18 2022
@@ -0,0 +1 @@
+38352f762e2592ad5387f6391db010e1a00ff25eadc5d4a5963eb24a6f572882269571ebbea45ebc4105dfd0a69995d88f78e0ccd7f39ddc958e357326df9590
  pulsar-client-node-1.6.0.tar.gz




[pulsar-client-node] annotated tag v1.6.0-rc.2 updated (867ac6e -> 1dcf26c)

2022-02-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to annotated tag v1.6.0-rc.2
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git.


*** WARNING: tag v1.6.0-rc.2 was modified! ***

from 867ac6e  (commit)
  to 1dcf26c  (tag)
 tagging 867ac6e97f0aec917f389d9f6a61e749de6c26a4 (commit)
 replaces v1.6.0-rc.1
  by guangning
  on Mon Feb 28 20:28:24 2022 +0800

- Log -
Release v1.6.0-rc.2
-BEGIN PGP SIGNATURE-

iQFJBAABCAAzFiEEfLgyKwIZSFWNsgIYV3wHyoZ66RAFAmIcv+gVHGd1YW5nbmlu
Z0BhcGFjaGUub3JnAAoJEFd8B8qGeukQdloH+wfLaf66C3I7Sr/OKJyA7URT5ea4
D9VM7hWzOmCiLJffxJvD4HBIj+gz29jRDHJSK1WjZ6D7mYLbWj/WCYZGJ5ripnOX
XafAAiUs31Aq8qdqHmf1aHoeiXATh/Zlj8D3nMyPhVF+dhtdpTuopDaEyxTTYU4D
O51qnDPlICKbTL9XVYW4SFldR7+y3xb+2wGu+thXpcEwz3To2L1OmIX65Wr/+NYS
XMc9g792DA8WMNonK//Y1x1n3kCmnlLNQN5mfAmvPutNjhdfjhS/Q7ibpPl8wp4z
7IWPqpGXcTIg6afpLJxvImKP4P/P1oll8wAd7nEhd3kG5UIyL5gKrEkImVk=
=iYDz
-END PGP SIGNATURE-
---


No new revisions were added by this update.

Summary of changes:


[pulsar-client-node] 01/01: Merge branch 'master' into branch-1.6

2022-02-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git

commit 867ac6e97f0aec917f389d9f6a61e749de6c26a4
Merge: a559675 bd04459
Author: guangning 
AuthorDate: Mon Feb 28 20:22:44 2022 +0800

Merge branch 'master' into branch-1.6

 README.md   | 23 +++
 binding.gyp | 13 +
 2 files changed, 36 insertions(+)


[pulsar-client-node] branch branch-1.6 updated (a559675 -> 867ac6e)

2022-02-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git.


from a559675  Release v1.6.0
 add bd04459  Fixed pulsar client node mac install script (#196)
 new 867ac6e  Merge branch 'master' into branch-1.6

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md   | 23 +++
 binding.gyp | 13 +
 2 files changed, 36 insertions(+)


[pulsar] branch master updated: [Issue 13019][es-sink] Support event-time-based index name in ES Sink (#14383)

2022-02-27 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 21c3a0b  [Issue 13019][es-sink] Support event-time-based index name in 
ES Sink (#14383)
21c3a0b is described below

commit 21c3a0b5c93fd30fd458fbab818d059fef4fd8ba
Author: Yang Yang 
AuthorDate: Mon Feb 28 11:34:15 2022 +0800

[Issue 13019][es-sink] Support event-time-based index name in ES Sink 
(#14383)

Fixes https://github.com/apache/pulsar/issues/13019

### Motivation

As described in the original issue, it's a common request to write data to 
event-time-based indices in logs and metrics use cases, therefore it would be 
very helpful to have builtin support in the ES sink.

### Modifications

*Describe the modifications you've done.*

### Verifying this change

- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
  - *Added test cases for index name formatter*
---
 .../io/elasticsearch/ElasticSearchClient.java  | 35 
 .../io/elasticsearch/ElasticSearchConfig.java  | 12 +--
 .../io/elasticsearch/IndexNameFormatter.java   | 98 ++
 .../io/elasticsearch/ElasticSearchClientTests.java | 32 +++
 .../io/elasticsearch/IndexNameFormatterTest.java   | 52 
 site2/website-next/docs/io-elasticsearch-sink.md   |  2 +-
 6 files changed, 210 insertions(+), 21 deletions(-)

diff --git 
a/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClient.java
 
b/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClient.java
index 78b8c86..25c0688 100644
--- 
a/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClient.java
+++ 
b/pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClient.java
@@ -35,7 +35,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
@@ -125,9 +124,15 @@ public class ElasticSearchClient implements AutoCloseable {
 final ConcurrentMap, Record> records = new 
ConcurrentHashMap<>();
 final AtomicReference irrecoverableError = new 
AtomicReference<>();
 final ScheduledExecutorService executorService;
+private final IndexNameFormatter indexNameFormatter;
 
 ElasticSearchClient(ElasticSearchConfig elasticSearchConfig) {
 this.config = elasticSearchConfig;
+if (this.config.getIndexName() != null) {
+this.indexNameFormatter = new 
IndexNameFormatter(this.config.getIndexName());
+} else {
+this.indexNameFormatter = null;
+}
 this.configCallback = new ConfigCallback();
 this.backoffRetry = new 
RandomExponentialRetry(elasticSearchConfig.getMaxRetryTimeInSec());
 if (!config.isBulkEnabled()) {
@@ -254,7 +259,7 @@ public class ElasticSearchClient implements AutoCloseable {
 }
 
 IndexRequest makeIndexRequest(Record record, Pair idAndDoc) throws IOException {
-IndexRequest indexRequest = 
Requests.indexRequest(indexName(record.getTopicName()));
+IndexRequest indexRequest = Requests.indexRequest(indexName(record));
 if (!Strings.isNullOrEmpty(idAndDoc.getLeft())) {
 indexRequest.id(idAndDoc.getLeft());
 }
@@ -264,16 +269,16 @@ public class ElasticSearchClient implements AutoCloseable 
{
 }
 
 DeleteRequest makeDeleteRequest(Record record, String id) 
throws IOException {
-DeleteRequest deleteRequest = 
Requests.deleteRequest(indexName(record.getTopicName()));
+DeleteRequest deleteRequest = 
Requests.deleteRequest(indexName(record));
 deleteRequest.id(id);
 deleteRequest.type(config.getTypeName());
 return deleteRequest;
 }
 
-public void bulkIndex(Record record, Pair idAndDoc) throws 
Exception {
+public void bulkIndex(Record record, Pair 
idAndDoc) throws Exception {
 try {
 checkNotFailed();
-checkIndexExists(record.getTopicName());
+checkIndexExists(record);
 IndexRequest indexRequest = makeIndexRequest(record, idAndDoc);
 records.put(indexRequest, record);
 bulkProcessor.add(indexRequest);
@@ -294,7 +299,7 @@ public class ElasticSearchClient implements AutoCloseable {
 public boolean indexDocument(Record record, Pair idAndDoc) throws Exception {
 try {
 checkNotFailed();
-checkIndexExists(record.getTopicName());
+checkIndexExists(record);
 IndexResponse indexResponse = 
client.index(makeInde

[pulsar] branch master updated (c35ac3f -> 330fcb9)

2022-02-27 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from c35ac3f  [Transaction] Call getCause() after exception wrapped by 
completeFuture (#14214)
 add 330fcb9  [broker][authentication]Support pass http auth status (#14044)

No new revisions were added by this update.

Summary of changes:
 .../authentication/AuthenticationProvider.java |  8 ++
 .../authentication/AuthenticationProviderList.java | 31 
 .../AuthenticationProviderToken.java   | 43 ---
 .../authentication/AuthenticationService.java  | 24 +-
 .../OneStageAuthenticationState.java   |  7 ++
 .../pulsar/broker/web/AuthenticationFilter.java| 20 -
 .../AuthenticationProviderListTest.java| 45 
 .../pulsar/broker/web/PulsarWebResource.java   |  8 +-
 .../client/api/AuthenticationDataProvider.java |  2 +
 .../client/impl/auth/AuthenticationBasic.java  |  3 +-
 .../client/impl/auth/AuthenticationDataBasic.java  |  9 ++-
 .../client/impl/auth/AuthenticationDataTls.java| 10 +++
 .../client/impl/auth/AuthenticationDataToken.java  |  8 +-
 .../pulsar/client/impl/auth/AuthenticationTls.java |  4 +-
 .../client/impl/auth/AuthenticationToken.java  |  3 +-
 .../impl/auth/oauth2/AuthenticationDataOAuth2.java |  9 ++-
 .../client/impl/auth/AuthenticationTokenTest.java  | 15 ++--
 .../functions/worker/rest/FunctionApiResource.java |  6 +-
 .../functions/worker/rest/api/ComponentImpl.java   | 12 +--
 .../functions/worker/rest/api/FunctionsImpl.java   |  5 +-
 .../functions/worker/rest/api/SinksImpl.java   |  5 +-
 .../functions/worker/rest/api/SourcesImpl.java | 21 +++---
 .../functions/worker/service/api/Component.java| 41 ++-
 .../functions/worker/service/api/Functions.java| 85 +-
 .../pulsar/functions/worker/service/api/Sinks.java | 85 +-
 .../functions/worker/service/api/Sources.java  | 85 +-
 .../pulsar/websocket/AbstractWebSocketHandler.java | 24 +-
 .../websocket/admin/WebSocketWebResource.java  | 24 --
 .../websocket/admin/WebSocketWebResourceTest.java  |  4 +
 29 files changed, 563 insertions(+), 83 deletions(-)


[pulsar-client-node] branch master updated: Fixed pulsar client node mac install script (#196)

2022-02-27 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
 new bd04459  Fixed pulsar client node mac install script (#196)
bd04459 is described below

commit bd04459bf747920a606586f09db98f21274e22a9
Author: Guangning E 
AuthorDate: Mon Feb 28 09:55:17 2022 +0800

Fixed pulsar client node mac install script (#196)

* Fixed pulsar client node mac install script
---
 README.md   | 23 +++
 binding.gyp | 13 +
 2 files changed, 36 insertions(+)

diff --git a/README.md b/README.md
index 57ee0fd..cafc5c9 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,7 @@ cmake \
 cmake --config Release
 ```
 
+
 2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a 
Windows command tool.
 
 ```shell
@@ -79,6 +80,28 @@ set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
 set OS_ARCH=x64-windows
 ```
 
+### Install on mac
+
+1. Install the Pulsar C++ client on mac.
+
+```shell
+brew install libpulsar
+```
+
+2. Get the installation path of libpulsar
+
+```shell
+brew info libpulsar
+```
+
+
+2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a 
mac command tool.
+
+```shell
+# for example
+export PULSAR_CPP_DIR=/usr/local/Cellar/libpulsar/2.9.1_1
+```
+
 
 ### Install pulsar-client to your project
 
diff --git a/binding.gyp b/binding.gyp
index 03dd8b5..68629b1 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -24,6 +24,11 @@
'pulsar_cpp_dir%': '

svn commit: r52696 - in /dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1: ./ pulsar-client-node-1.6.0.tar.gz pulsar-client-node-1.6.0.tar.gz.asc pulsar-client-node-1.6.0.tar.gz.sha5

2022-02-22 Thread guangning
Author: guangning
Date: Tue Feb 22 13:42:09 2022
New Revision: 52696

Log:
Staging artifacts and signature for Pulsar Node.js client release 
1.6.0-candidate-1

Added:
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz
   (with props)

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.asc

dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.sha512

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz
==
Binary file - no diff available.

Propchange: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz
--
svn:mime-type = application/octet-stream

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.asc
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.asc
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.asc
 Tue Feb 22 13:42:09 2022
@@ -0,0 +1,11 @@
+-BEGIN PGP SIGNATURE-
+
+iQEzBAABCAAdFiEEfLgyKwIZSFWNsgIYV3wHyoZ66RAFAmIU5wQACgkQV3wHyoZ6
+6RBz3gf/ceWQ2Yg1h6snmhunxV8pB51QZN9VgqpjYIl6Q4HtMehiSolBMTF/oJ8i
+8hI/CZKsdTD28C7XPsbaK2IkMMFhz0WMtJGryZF+tmJ1TDh0hXnJ/t62/oXNRBDe
+odWcogem9Wr1VZSCsERu0l4qRe1vns3axO7QxyZvYSKz3pxLylpgEtzd22LmW08v
+t//Q1UMlWCK39FswDqfZkn2pk/Lrk8ybqqzrLwpBmJyQn7wntTu1f4Bj6V+Hn6nl
+EYYfS+U2lm/XcFSWIZ7vuibSCu9XjbvZDN1EF5p9j3Oew1N3YxwVwOf6jTO2l31Z
+mrO8Y68J80L3v0ho4QMF+Ng/bJYpYw==
+=G9cf
+-END PGP SIGNATURE-

Added: 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.sha512
==
--- 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.sha512
 (added)
+++ 
dev/pulsar/pulsar-client-node/pulsar-client-node-1.6.0-candidate-1/pulsar-client-node-1.6.0.tar.gz.sha512
 Tue Feb 22 13:42:09 2022
@@ -0,0 +1 @@
+64662be31053f76260a6f677bce87a5448f7377f1dae17bfbf69a2947084844ab8e78aee8716ed8dc70a586c1ca160f1d57a5b7e1637a538d2b318bfd62622be
  pulsar-client-node-1.6.0.tar.gz




[pulsar-client-node] annotated tag v1.6.0-rc.1 updated (a559675 -> f41a48b)

2022-02-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to annotated tag v1.6.0-rc.1
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git.


*** WARNING: tag v1.6.0-rc.1 was modified! ***

from a559675  (commit)
  to f41a48b  (tag)
 tagging a559675a5e6d511c8ded9d280a9a649b80ed77d0 (commit)
  by guangning
  on Tue Feb 22 12:33:03 2022 +0800

- Log -
Release v1.6.0-rc.1
---


No new revisions were added by this update.

Summary of changes:


[pulsar-client-node] 01/01: Release v1.6.0

2022-02-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git

commit a559675a5e6d511c8ded9d280a9a649b80ed77d0
Author: guangning 
AuthorDate: Tue Feb 22 12:29:46 2022 +0800

Release v1.6.0
---
 package-lock.json | 2 +-
 package.json  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 06008c8..61e2d10 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "pulsar-client",
-  "version": "1.6.0-rc.0",
+  "version": "1.6.0",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
diff --git a/package.json b/package.json
index eb56e5e..b597949 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pulsar-client",
-  "version": "1.6.0-rc.0",
+  "version": "1.6.0",
   "description": "Pulsar Node.js client",
   "main": "index.js",
   "types": "index.d.ts",


[pulsar-client-node] branch branch-1.6 created (now a559675)

2022-02-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git.


  at a559675  Release v1.6.0

This branch includes the following new commits:

 new a559675  Release v1.6.0

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[pulsar-client-node] branch master updated: Fixed windows install client (#194)

2022-02-17 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
 new d2c0d1e  Fixed windows install client (#194)
d2c0d1e is described below

commit d2c0d1e374f8e9f25934bd679436da0872b6bc8e
Author: Guangning E 
AuthorDate: Thu Feb 17 19:09:25 2022 +0800

Fixed windows install client (#194)

* Support for specified architectures
---
 README.md   | 19 ++-
 binding.gyp | 21 +++--
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index 5b8593a..57ee0fd 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,17 @@ If an incompatible version of the C++ client is installed, 
you may fail to build
 
 ### Install on windows
 
-1. [Build the Pulsar C++ client on 
windows](https://pulsar.apache.org/docs/en/next/client-libraries-cpp/).
+1. Build the Pulsar C++ client on windows.
+
+```shell
+cmake \
+ -A x64 \
+ -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
+ -DVCPKG_TRIPLET=x64-windows \
+ -DCMAKE_BUILD_TYPE=Release \
+ -S .
+cmake --config Release
+```
 
 2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a 
Windows command tool.
 
@@ -63,6 +73,13 @@ If an incompatible version of the C++ client is installed, 
you may fail to build
 set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
 ```
 
+3. Set the variable `OS_ARCH` in a Windows command tool, `OS_ARCH` is related 
to the configuration of VCPKG_TRIPLET on the command line above.(Optional)
+
+```shell
+set OS_ARCH=x64-windows
+```
+
+
 ### Install pulsar-client to your project
 
 ```shell
diff --git a/binding.gyp b/binding.gyp
index a524f19..03dd8b5 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -22,6 +22,7 @@
 ['OS=="win"', {
   'variables': {
'pulsar_cpp_dir%': '

[pulsar-manager] branch master updated (73e4ae3 -> 6531eff)

2022-02-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 73e4ae3  Fix for Sidebar items not visible to admin and superadmin 
(#435)
 add 6531eff  Add filterable to el-select enables filtering for 
tenant/namespace/topic (#439) (#440)

No new revisions were added by this update.

Summary of changes:
 front-end/src/views/management/brokers/broker.vue  | 2 +-
 front-end/src/views/management/namespaces/namespace.vue| 4 ++--
 front-end/src/views/management/tenants/tenant.vue  | 2 +-
 front-end/src/views/management/topics/partitionedTopic.vue | 6 +++---
 front-end/src/views/management/topics/topic.vue| 8 
 5 files changed, 11 insertions(+), 11 deletions(-)


[pulsar-client-node] branch master updated: Feature support oauth2 for node client (#190)

2022-01-17 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
 new f696d2f  Feature support oauth2 for node client (#190)
f696d2f is described below

commit f696d2fd958b702122ca7a21f84642ea855ec25d
Author: Guangning E 
AuthorDate: Mon Jan 17 16:43:17 2022 +0800

Feature support oauth2 for node client (#190)

* The cpp client already supports oauth2 authentication, and some users 
want to support this feature in the node js client as well, so enable it in the 
node js client
---
 index.d.ts  | 14 +-
 index.js|  2 ++
 src/Authentication.cc   |  7 +++
 index.js => src/AuthenticationOauth2.js | 28 +++-
 tstest.ts   | 17 +
 5 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/index.d.ts b/index.d.ts
index c8186c8..ac498ff 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -20,7 +20,7 @@
 
 export interface ClientConfig {
   serviceUrl: string;
-  authentication?: AuthenticationTls | AuthenticationAthenz | 
AuthenticationToken;
+  authentication?: AuthenticationTls | AuthenticationAthenz | 
AuthenticationToken | AuthenticationOauth2;
   operationTimeoutSeconds?: number;
   ioThreads?: number;
   messageListenerThreads?: number;
@@ -175,6 +175,18 @@ export class AuthenticationToken {
   constructor(params: { token: string });
 }
 
+export class AuthenticationOauth2 {
+  constructor(params: {
+type: string;
+issuer_url: string;
+client_id?: string;
+client_secret?: string;
+private_key?: string;
+audience?: string;
+scope?: string;
+  });
+}
+
 export enum LogLevel {
   DEBUG = 0,
   INFO = 1,
diff --git a/index.js b/index.js
index 461a853..d3e3b94 100644
--- a/index.js
+++ b/index.js
@@ -21,6 +21,7 @@ const PulsarBinding = require('bindings')('Pulsar');
 const AuthenticationTls = require('./src/AuthenticationTls.js');
 const AuthenticationAthenz = require('./src/AuthenticationAthenz.js');
 const AuthenticationToken = require('./src/AuthenticationToken.js');
+const AuthenticationOauth2 = require('./src/AuthenticationOauth2.js');
 
 const LogLevel = {
   DEBUG: 0,
@@ -36,6 +37,7 @@ const Pulsar = {
   AuthenticationTls,
   AuthenticationAthenz,
   AuthenticationToken,
+  AuthenticationOauth2,
   LogLevel,
 };
 
diff --git a/src/Authentication.cc b/src/Authentication.cc
index 226fd0a..35de2d9 100644
--- a/src/Authentication.cc
+++ b/src/Authentication.cc
@@ -80,6 +80,13 @@ Authentication::Authentication(const Napi::CallbackInfo 
)
   return;
 }
 this->cAuthentication = 
pulsar_authentication_athenz_create(info[1].ToString().Utf8Value().c_str());
+  } else if (authMethod == "oauth2") {
+if (info.Length() < 2 || !info[1].IsString()) {
+  Napi::Error::New(env, "Authentication parameter must be a JSON string 
for oauth2")
+  .ThrowAsJavaScriptException();
+  return;
+}
+this->cAuthentication = 
pulsar_authentication_oauth2_create(info[1].ToString().Utf8Value().c_str());
   } else {
 Napi::Error::New(env, "Unsupported authentication 
method").ThrowAsJavaScriptException();
 return;
diff --git a/index.js b/src/AuthenticationOauth2.js
similarity index 63%
copy from index.js
copy to src/AuthenticationOauth2.js
index 461a853..cd5b328 100644
--- a/index.js
+++ b/src/AuthenticationOauth2.js
@@ -16,27 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 const PulsarBinding = require('bindings')('Pulsar');
-const AuthenticationTls = require('./src/AuthenticationTls.js');
-const AuthenticationAthenz = require('./src/AuthenticationAthenz.js');
-const AuthenticationToken = require('./src/AuthenticationToken.js');
-
-const LogLevel = {
-  DEBUG: 0,
-  INFO: 1,
-  WARN: 2,
-  ERROR: 3,
-};
 
-const Pulsar = {
-  Client: PulsarBinding.Client,
-  Message: PulsarBinding.Message,
-  MessageId: PulsarBinding.MessageId,
-  AuthenticationTls,
-  AuthenticationAthenz,
-  AuthenticationToken,
-  LogLevel,
-};
+class AuthenticationOauth2 {
+  constructor(params) {
+const paramsStr = (typeof params === 'object') ? JSON.stringify(params) : 
params;
+this.binding = new PulsarBinding.Authentication('oauth2', paramsStr);
+  }
+}
 
-module.exports = Pulsar;
+module.exports = AuthenticationOauth2;
diff --git a/tstest.ts b/tstest.ts
index 43042bc..220854d 100644
--- a/tstest.ts
+++ b/tstest.ts
@@ -39,6 +39,23 @@ import Pulsar = require('./index');
 tokenExpirationTime: '3600',
   });
 
+  const authOauth2PrivateKey: Pulsar.AuthenticationOauth2 = new 
Pulsar.AuthenticationOauth2({
+type: "client_credentials",
+issuer_url: "issuer-url",
+private_key: "credent

[pulsar-manager] branch master updated: Fix for Sidebar items not visible to admin and superadmin (#435)

2022-01-13 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 73e4ae3  Fix for Sidebar items not visible to admin and superadmin 
(#435)
73e4ae3 is described below

commit 73e4ae37cdab1d8f1f6c08fd5aaca91c612687b6
Author: Sourabh Agrawal 
AuthorDate: Thu Jan 13 20:07:34 2022 +0530

Fix for Sidebar items not visible to admin and superadmin (#435)

### Motivation


*All newly added sidebar items (Roles,Users etc)  are not visible to 
superadmin. Also when admin user login, only Token tab is visible to them.*

### Modifications

*Added a new method isAccessbile in SidebarItem.vue. It compares roles 
which are set in Item.metadata.roles with logged-in user role, based on which 
the item is either visible or hidden for user*

### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 .../src/views/layout/components/Sidebar/SidebarItem.vue  | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/front-end/src/views/layout/components/Sidebar/SidebarItem.vue 
b/front-end/src/views/layout/components/Sidebar/SidebarItem.vue
index 7815577..328cf8a 100644
--- a/front-end/src/views/layout/components/Sidebar/SidebarItem.vue
+++ b/front-end/src/views/layout/components/Sidebar/SidebarItem.vue
@@ -29,7 +29,7 @@
 
   
 
-  
+  
  {
-if (item.hidden) {
+if (!this.isAccessible(item)) {
   return false
 } else {
   // Temp set(will be used if only has one showing child)
@@ -115,6 +118,13 @@ export default {
 isExternalLink(routePath) {
   return isExternal(routePath)
 },
+isAccessible(item) {
+  const accessibleItemList = item.meta.roles.filter(i => {
+if (this.roles.includes(i)) { return true } else { return false }
+  })
+  if (accessibleItemList.length > 0) { return true }
+  return false
+},
 generateTitle
   }
 }


[pulsar-manager] branch master updated: Allow user to assign tenant to role (#436)

2022-01-13 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new dfbb19b  Allow user to assign tenant to role (#436)
dfbb19b is described below

commit dfbb19ba44a5f65e43a79969b3d2a724bacac267
Author: Sourabh Agrawal 
AuthorDate: Thu Jan 13 20:07:12 2022 +0530

Allow user to assign tenant to role (#436)

### Motivation
Improve Tenant/Namespace resource assignment workflow.

* When assigning the resource to a role, it only let you choose from 
Namespace,SCHEMA,Functions but does not allow the user to select TENANT. A user 
should have ability to choose tenant for a role and assign the role to a user. 
Based on which the user should be able to see the tenant it is assigned with.


### Modifications

* changes in this PR include below fixes.
1. Add TENANT as ResourceType along with Namepsace,Schema etc for 
Create/Edit Role.
2. Include only tenants as resource while preparing the response from api 
/tenants in TenantsController.
3. In Success LoginResponse, add the tenant as header which is assigned to 
user's role instead of tenant with user's name.

### Verifying this change

- [ ] Make sure that the change passes the `./gradlew build` checks.
---
 .../pulsar/manager/controller/LoginController.java | 12 -
 .../pulsar/manager/controller/RolesController.java | 31 +-
 .../manager/controller/TenantsController.java  |  4 ++-
 .../pulsar/manager/dao/TenantsRepositoryImpl.java  |  5 
 .../pulsar/manager/entity/TenantsRepository.java   |  2 ++
 .../pulsar/manager/mapper/TenantsMapper.java   |  4 +++
 .../manager/dao/TenantsRepositoryImplTest.java | 18 -
 7 files changed, 67 insertions(+), 9 deletions(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/controller/LoginController.java 
b/src/main/java/org/apache/pulsar/manager/controller/LoginController.java
index 4973a32..7e199ee 100644
--- a/src/main/java/org/apache/pulsar/manager/controller/LoginController.java
+++ b/src/main/java/org/apache/pulsar/manager/controller/LoginController.java
@@ -20,6 +20,8 @@ import org.apache.pulsar.manager.entity.RoleBindingEntity;
 import org.apache.pulsar.manager.entity.RoleBindingRepository;
 import org.apache.pulsar.manager.entity.RoleInfoEntity;
 import org.apache.pulsar.manager.entity.RolesRepository;
+import org.apache.pulsar.manager.entity.TenantEntity;
+import org.apache.pulsar.manager.entity.TenantsRepository;
 import org.apache.pulsar.manager.entity.UserInfoEntity;
 import org.apache.pulsar.manager.entity.UsersRepository;
 import org.apache.pulsar.manager.service.JwtService;
@@ -27,6 +29,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
+import org.apache.pulsar.manager.utils.ResourceType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
@@ -81,6 +84,9 @@ public class LoginController {
 @Autowired
 private RoleBindingRepository roleBindingRepository;
 
+@Autowired
+private TenantsRepository tenantsRepository;
+
 @ApiOperation(value = "Login pulsar manager")
 @ApiResponses({
 @ApiResponse(code = 200, message = "ok"),
@@ -112,7 +118,7 @@ public class LoginController {
 result.put("login", "success");
 headers.add("token", token);
 headers.add("username", userAccount);
-headers.add("tenant", userAccount);
+
 jwtService.setToken(request.getSession().getId(), token);
 List roleBindingEntities = 
roleBindingRepository.
 findByUserId(userInfoEntity.getUserId());
@@ -123,6 +129,10 @@ public class LoginController {
 if (!roleIdList.isEmpty()) {
 List roleInfoEntities = 
rolesRepository.findAllRolesByMultiId(roleIdList);
 for (RoleInfoEntity roleInfoEntity : roleInfoEntities) {
+
if(roleInfoEntity.getResourceType().equals(ResourceType.TENANTS.name())){
+Optional tenantEntity = 
tenantsRepository.findByTenantId(roleInfoEntity.getResourceId());
+headers.add("tenant",tenantEntity.get().getTenant());
+}
 if (roleInfoEntity.getFlag() == 0) {
 // Super users can access all types
 return new ResponseEntity<>(result, headers, 
HttpStatus.OK);
diff --git 
a/src/main/java/org/apache/pulsar/manager/controller/RolesController.java 
b/src/main/java/org/apache/pulsar/man

[pulsar-manager] branch master updated: Updated to fix Log4J security vulnerabilities (#438)

2022-01-10 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new b46a59a  Updated to fix Log4J security vulnerabilities (#438)
b46a59a is described below

commit b46a59a0d0242a983db1898d46c2f2a4791c720b
Author: Nicholas Nezis 
AuthorDate: Tue Jan 11 00:10:28 2022 -0500

Updated to fix Log4J security vulnerabilities (#438)
---
 build.gradle | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/build.gradle b/build.gradle
index 26315a8..b629cba 100644
--- a/build.gradle
+++ b/build.gradle
@@ -99,6 +99,8 @@ jar {
 }
 }
 
+ext['log4j2.version'] = '2.17.1'
+
 dependencies {
 compile group: 'org.springframework.boot', name: 'spring-boot-starter', 
version: springBootVersion
 compile group: 'org.springframework.boot', name: 
'spring-boot-starter-web', version: springBootVersion


[pulsar] branch master updated (6a4cbf7 -> 040066f)

2021-12-29 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 6a4cbf7  [Doc] add docs for client, security, geo (#13556)
 add 040066f  fix: website build fail due to download page parse error 
(#13566)

No new revisions were added by this update.

Summary of changes:
 site2/website/pages/en/download.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[pulsar] branch master updated (a471896 -> ef8120f)

2021-12-29 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from a471896  Max unacked messages on subscription support cross multiple 
clusters (#13549)
 add ef8120f  fix: website build fail due to can't find classes (#13562)

No new revisions were added by this update.

Summary of changes:
 site2/tools/docker-build-site.sh | 3 +++
 1 file changed, 3 insertions(+)


[pulsar] branch master updated (c627a0e -> d1b4255)

2021-12-29 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from c627a0e  [Blog] add 2.7.4 release blog (#13465)
 add d1b4255  fix: release note link anchor jumper incorrect in version 
page (#13546)

No new revisions were added by this update.

Summary of changes:
 site2/website/pages/en/download.js | 2 +-
 site2/website/pages/en/versions.js | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


[pulsar] branch master updated (8378e64 -> b3c5772)

2021-12-14 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 8378e64  feat(docs): add more limitations for replicated subscriptions 
(#13230)
 add b3c5772  feat: optimize website build (#13191)

No new revisions were added by this update.

Summary of changes:
 .github/workflows/ci-pulsar-website-build.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[pulsar-manager] branch master updated: fix: typo in readme (#421)

2021-11-24 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 994ad84  fix: typo in readme (#421)
994ad84 is described below

commit 994ad84ee3b1a73f978e1e31950c961ce4a69cf6
Author: Eric Shen 
AuthorDate: Wed Nov 24 21:55:40 2021 -0600

fix: typo in readme (#421)

Signed-off-by: ericsyh 
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index e1e2f6b..4374b2c 100644
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@ The Pulsar Manager can be deployed as part of [Pulsar Helm 
Chart](https://github
 ```
 After find the ip address of the Pulsar Manager, you can access the Pulsar 
Manager at `http://${pulsar-manager-cluster-ip}/#/environments`.
 
-### Build from bin package
+### Deploy from bin package
 
 ```
 wget 
https://dist.apache.org/repos/dist/release/pulsar/pulsar-manager/pulsar-manager-0.2.0/apache-pulsar-manager-0.2.0-bin.tar.gz


[pulsar-manager] branch master updated: fix pulsar with multiple admin httpserver (#423)

2021-11-24 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 6d9c057  fix pulsar with multiple admin httpserver (#423)
6d9c057 is described below

commit 6d9c0574cbce51f32282c794c9d0e81e502f4ec8
Author: asagjj 
AuthorDate: Thu Nov 25 11:55:17 2021 +0800

fix pulsar with multiple admin httpserver (#423)
---
 .../service/impl/EnvironmentCacheServiceImpl.java  | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/service/impl/EnvironmentCacheServiceImpl.java
 
b/src/main/java/org/apache/pulsar/manager/service/impl/EnvironmentCacheServiceImpl.java
index 490282c..cce6ba0 100644
--- 
a/src/main/java/org/apache/pulsar/manager/service/impl/EnvironmentCacheServiceImpl.java
+++ 
b/src/main/java/org/apache/pulsar/manager/service/impl/EnvironmentCacheServiceImpl.java
@@ -29,6 +29,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
 import javax.servlet.http.HttpServletRequest;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -87,10 +88,25 @@ public class EnvironmentCacheServiceImpl implements 
EnvironmentCacheService {
 EnvironmentEntity environmentEntity = 
environmentEntityOptional.get();
 return environmentEntity.getBroker();
 } else {
-return getServiceUrl(environment, cluster, 0);
+String webServiceUrl = getServiceUrl(environment, cluster, 0);
+return pickOneServiceUrl(webServiceUrl);
 }
 }
 
+private String pickOneServiceUrl(String webServiceUrl) {
+if (webServiceUrl.contains(",")) {
+String[] webServiceUrlList = webServiceUrl.split(",");
+int index = ThreadLocalRandom.current().nextInt(0, 
webServiceUrlList.length);
+String url = webServiceUrlList[index];
+if (!url.contains("http://;)) {
+url = "http://; + url;
+}
+log.info("pick web url:{}", url);
+return url;
+}
+return webServiceUrl;
+}
+
 private String getServiceUrl(String environment, String cluster, int 
numReloads) {
 // if there is a cluster specified, lookup the cluster.
 Map clusters = environments.get(environment);


[pulsar] branch branch-2.8 updated: [C++] Use URL encoded content type for OAuth 2.0 authentication (#12341)

2021-10-13 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch-2.8 by this push:
 new 6369e46  [C++] Use URL encoded content type for OAuth 2.0 
authentication (#12341)
6369e46 is described below

commit 6369e461d862a95bee1f49d340c0a637ed9add5a
Author: Yunze Xu 
AuthorDate: Wed Oct 13 17:05:16 2021 +0800

[C++] Use URL encoded content type for OAuth 2.0 authentication (#12341)

Fixes #12334

### Motivation

When C++ client sends a HTTP request for the access token from a OAuth 2.0 
server, the content type is JSON, which is incorrect and might not work in some 
cases.

### Modifications

- Replace `generateJsonBody` with `generateParamMap` to create a map that 
contains the necessary keys from `CredentialsFlow`.
- Add a `buildClientCredentialsBody` method to convert the map to URL 
encoded string.
- Change the content type from `json` to `x-www-form-urlencoded`.

### Verifying this change

- [x] Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as 
`AuthPluginTest.testOauth2RequestBody`. This PR changes the test to verify 
`generateParamMap` because `generateJsonBody` is removed.

(cherry picked from commit 4ae7f6a1b38a003c9fc26844e52771b776bf64bf)
---
 pulsar-client-cpp/lib/auth/AuthOauth2.cc  | 72 ++-
 pulsar-client-cpp/lib/auth/AuthOauth2.h   |  2 +-
 pulsar-client-cpp/tests/AuthPluginTest.cc | 27 +---
 3 files changed, 62 insertions(+), 39 deletions(-)

diff --git a/pulsar-client-cpp/lib/auth/AuthOauth2.cc 
b/pulsar-client-cpp/lib/auth/AuthOauth2.cc
index a9a1498..ed39ea5 100644
--- a/pulsar-client-cpp/lib/auth/AuthOauth2.cc
+++ b/pulsar-client-cpp/lib/auth/AuthOauth2.cc
@@ -234,41 +234,71 @@ void ClientCredentialFlow::initialize() {
 }
 void ClientCredentialFlow::close() {}
 
-std::string ClientCredentialFlow::generateJsonBody() const {
+ParamMap ClientCredentialFlow::generateParamMap() const {
 if (!keyFile_.isValid()) {
-return "";
+return {};
 }
 
-// fill in the request data
-boost::property_tree::ptree pt;
-pt.put("grant_type", "client_credentials");
-pt.put("client_id", keyFile_.getClientId());
-pt.put("client_secret", keyFile_.getClientSecret());
-pt.put("audience", audience_);
+ParamMap params;
+params.emplace("grant_type", "client_credentials");
+params.emplace("client_id", keyFile_.getClientId());
+params.emplace("client_secret", keyFile_.getClientSecret());
+params.emplace("audience", audience_);
 if (!scope_.empty()) {
-pt.put("scope", scope_);
+params.emplace("scope", scope_);
+}
+return params;
+}
+
+static std::string buildClientCredentialsBody(CURL* curl, const ParamMap& 
params) {
+std::ostringstream oss;
+bool addSeparater = false;
+
+for (const auto& kv : params) {
+if (addSeparater) {
+oss << "&";
+} else {
+addSeparater = true;
+}
+
+char* encodedKey = curl_easy_escape(curl, kv.first.c_str(), 
kv.first.length());
+if (!encodedKey) {
+LOG_ERROR("curl_easy_escape for " << kv.first << " failed");
+continue;
+}
+char* encodedValue = curl_easy_escape(curl, kv.second.c_str(), 
kv.second.length());
+if (!encodedValue) {
+LOG_ERROR("curl_easy_escape for " << kv.second << " failed");
+continue;
+}
+
+oss << encodedKey << "=" << encodedValue;
+curl_free(encodedKey);
+curl_free(encodedValue);
 }
 
-std::ostringstream ss;
-boost::property_tree::json_parser::write_json(ss, pt);
-return ss.str();
+return oss.str();
 }
 
 Oauth2TokenResultPtr ClientCredentialFlow::authenticate() {
 Oauth2TokenResultPtr resultPtr = Oauth2TokenResultPtr(new 
Oauth2TokenResult());
-const auto jsonBody = generateJsonBody();
-if (jsonBody.empty() || tokenEndPoint_.empty()) {
+if (tokenEndPoint_.empty()) {
 return resultPtr;
 }
-LOG_DEBUG("Generate JSON body for ClientCredentialFlow: " << jsonBody);
 
 CURL* handle = curl_easy_init();
+const auto postData = buildClientCredentialsBody(handle, 
generateParamMap());
+if (postData.empty()) {
+curl_easy_cleanup(handle);
+return resultPtr;
+}
+LOG_DEBUG("Generate URL encoded body for ClientCredentialFlow: " << 
postData);
+
 CURLcode res;
 std::string responseData;
 
-// set he

[pulsar] branch branch-2.8 updated: [C++] Handle OAuth 2.0 exceptional cases gracefully (#12335)

2021-10-12 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch-2.8 by this push:
 new 522af14  [C++] Handle OAuth 2.0 exceptional cases gracefully (#12335)
522af14 is described below

commit 522af14a098a05862e61f19228a7b291fcd7cba6
Author: Yunze Xu 
AuthorDate: Wed Oct 13 11:05:26 2021 +0800

[C++] Handle OAuth 2.0 exceptional cases gracefully (#12335)

Fixes #12324

Currently if any error happened during OAuth 2.0 authentication in C++ 
client, a runtime error would be thrown and could only be caught when creating 
an `AuthOauth` object, but could not be caught in `Client`'s method like 
`createProducer`. It's not graceful. What's worse, there's no way for Python 
client that is a wrapper of C++ client to caught this exception.

When `ClientCredentialFlow::authenticate` returns an invalid 
`Oauth2TokenResult`, catch the `runtime_error` thrown in `Oauth2CachedToken`'s 
constructor and returns `ResultAuthenticationError` as 
`AuthOauth2::getAuthData`'s returned value. Since `getAuthData` always returns 
`ResultOk` before this PR, the related docs are also modified.

Then when a CONNECT or AUTH_RESPONSE command is created, expose the result 
of `getAuthData`. If it's not `ResultOk`, close the connection and complete the 
connection's future with the result. After that, the `Client`'s API will be 
completed with the result.

In addition, this PR also makes the error code of libcurl human readable by 
configuring `CURLOPT_ERRORBUFFER`.

- [x] Make sure that the change passes the CI checks.

This change added tests `AuthPluginTest.testOauth2Failure` to verify when 
OAuth 2.0 authentication failed, the `createProducer` would return 
`ResultAuthenticationError` without any exception thrown.

(cherry picked from commit 06b68bb1d5859fd969f66c29888feda271817ec5)
---
 pulsar-client-cpp/include/pulsar/Authentication.h |  6 +--
 pulsar-client-cpp/lib/BinaryProtoLookupService.cc |  2 +-
 pulsar-client-cpp/lib/ClientConnection.cc | 21 ++--
 pulsar-client-cpp/lib/ClientConnection.h  |  2 +-
 pulsar-client-cpp/lib/Commands.cc | 18 +--
 pulsar-client-cpp/lib/Commands.h  |  4 +-
 pulsar-client-cpp/lib/HTTPLookupService.cc|  5 +-
 pulsar-client-cpp/lib/auth/AuthOauth2.cc  | 42 +++
 pulsar-client-cpp/tests/AuthPluginTest.cc | 62 ++-
 9 files changed, 121 insertions(+), 41 deletions(-)

diff --git a/pulsar-client-cpp/include/pulsar/Authentication.h 
b/pulsar-client-cpp/include/pulsar/Authentication.h
index 991e35b..185ac33 100644
--- a/pulsar-client-cpp/include/pulsar/Authentication.h
+++ b/pulsar-client-cpp/include/pulsar/Authentication.h
@@ -98,7 +98,7 @@ class PULSAR_PUBLIC Authentication {
  *
  * @param[out] authDataContent the shared pointer of AuthenticationData. 
The content of AuthenticationData
  * is changed to the internal data of the current instance.
- * @return ResultOk
+ * @return ResultOk or ResultAuthenticationError if authentication failed
  */
 virtual Result getAuthData(AuthenticationDataPtr& authDataContent) {
 authDataContent = authData_;
@@ -450,7 +450,7 @@ class CachedToken {
 /**
  * Get AuthenticationData from the current instance
  *
- * @return ResultOk
+ * @return ResultOk or ResultAuthenticationError if authentication failed
  */
 virtual AuthenticationDataPtr getAuthData() = 0;
 
@@ -504,7 +504,7 @@ class PULSAR_PUBLIC AuthOauth2 : public Authentication {
  *
  * @param[out] authDataOauth2 the shared pointer of AuthenticationData. 
The content of AuthenticationData
  * is changed to the internal data of the current instance.
- * @return ResultOk
+ * @return ResultOk or ResultAuthenticationError if authentication failed
  */
 Result getAuthData(AuthenticationDataPtr& authDataOauth2);
 
diff --git a/pulsar-client-cpp/lib/BinaryProtoLookupService.cc 
b/pulsar-client-cpp/lib/BinaryProtoLookupService.cc
index 069e0e2..c7b7b09 100644
--- a/pulsar-client-cpp/lib/BinaryProtoLookupService.cc
+++ b/pulsar-client-cpp/lib/BinaryProtoLookupService.cc
@@ -130,7 +130,7 @@ void 
BinaryProtoLookupService::sendPartitionMetadataLookupRequest(const std::str
   const 
ClientConnectionWeakPtr& clientCnx,
   
LookupDataResultPromisePtr promise) {
 if (result != ResultOk) {
-promise->setFailed(ResultConnectError);
+promise->setFailed(result);
 Future future = promise->getFuture();
 return;
 }
diff --git a/pulsar-client-cpp/lib/ClientConnection.cc 
b/pulsar-client-cpp/lib/ClientConnection.cc
i

[pulsar] branch branch-2.8 updated: [C++] Support configuring optional scope field for OAuth2 authentication (#12305)

2021-10-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch-2.8 by this push:
 new 8ef70a8  [C++] Support configuring optional scope field for OAuth2 
authentication (#12305)
8ef70a8 is described below

commit 8ef70a8f009e133830ff6951a97d32941cb049c8
Author: Yunze Xu 
AuthorDate: Sat Oct 9 08:14:40 2021 +0800

[C++] Support configuring optional scope field for OAuth2 authentication 
(#12305)

It's a C++ client catchup for https://github.com/apache/pulsar/pull/11931.

- Add a `scope_` field to `ClientCredentialFlow` and load it from 
`ParamMap` object whose key is `scope`.
- Refactor `ClientCredentialFlow` to simplify code and make it testable:
  - Use only one constructor instead of two overloaded constructors that 
might look confused
  - Add a `generateJsonBody` public method for generating JSON body for 
post fields in `authenticate` so that it can be tested.
  - Add a `KeyFile` class like what Java client does to load client id and 
client secret from `ParamMap` or file.

- [x] Make sure that the change passes the CI checks.

This change added test `AuthPluginTest.testOauth2RequestBody` for the cases 
that scope exists or doesn't exist.

(cherry picked from commit 44dcc04d037511984ec383fb3f2c75170e4cfefc)
---
 pulsar-client-cpp/lib/auth/AuthOauth2.cc  | 124 ++
 pulsar-client-cpp/lib/auth/AuthOauth2.h   |  35 +++--
 pulsar-client-cpp/tests/AuthPluginTest.cc |  32 
 3 files changed, 118 insertions(+), 73 deletions(-)

diff --git a/pulsar-client-cpp/lib/auth/AuthOauth2.cc 
b/pulsar-client-cpp/lib/auth/AuthOauth2.cc
index 33ae450..c7cc2bf 100644
--- a/pulsar-client-cpp/lib/auth/AuthOauth2.cc
+++ b/pulsar-client-cpp/lib/auth/AuthOauth2.cc
@@ -119,57 +119,50 @@ bool Oauth2CachedToken::isExpired() { return expiresAt_ < 
currentTimeMillis(); }
 Oauth2Flow::Oauth2Flow() {}
 Oauth2Flow::~Oauth2Flow() {}
 
-// ClientCredentialFlow
-static std::string readFromFile(const std::string& credentialsFilePath) {
-std::ifstream input(credentialsFilePath);
-std::stringstream buffer;
-buffer << input.rdbuf();
-return buffer.str();
-}
-
-ClientCredentialFlow::ClientCredentialFlow(const std::string& issuerUrl, const 
std::string& clientId,
-   const std::string& clientSecret, 
const std::string& audience) {
-issuerUrl_ = issuerUrl;
-clientId_ = clientId;
-clientSecret_ = clientSecret;
-audience_ = audience;
-this->initialize();
+KeyFile KeyFile::fromParamMap(ParamMap& params) {
+const auto it = params.find("private_key");
+if (it != params.cend()) {
+return fromFile(it->second);
+} else {
+return {params["client_id"], params["client_secret"]};
+}
 }
 
 // read clientId/clientSecret from passed in `credentialsFilePath`
-ClientCredentialFlow::ClientCredentialFlow(const std::string& issuerUrl,
-   const std::string& 
credentialsFilePath,
-   const std::string& audience) {
-issuerUrl_ = issuerUrl;
-audience_ = audience;
-
+KeyFile KeyFile::fromFile(const std::string& credentialsFilePath) {
 boost::property_tree::ptree loadPtreeRoot;
 try {
 boost::property_tree::read_json(credentialsFilePath, loadPtreeRoot);
-} catch (boost::property_tree::json_parser_error& e) {
-LOG_ERROR("Failed to parse json input file for credentialsFilePath: " 
<< credentialsFilePath
-  
<< "with error:" << e.what());
-return;
+} catch (const boost::property_tree::json_parser_error& e) {
+LOG_ERROR("Failed to parse json input file for credentialsFilePath: " 
<< credentialsFilePath << ": "
+  
<< e.what());
+return {};
 }
 
-const std::string defaultNotFoundString = "Client Id / Secret Not Found";
-
-clientId_ = loadPtreeRoot.get("client_id", 
defaultNotFoundString);
-clientSecret_ = loadPtreeRoot.get("client_secret", 
defaultNotFoundString);
-
-if (clientId_ == defaultNotFoundString || clientSecret_ == 
defaultNotFoundString) {
-LOG_ERROR("Not get valid clientId / clientSecret: " << clientId_ << 
"/" << clientSecret_);
-return;
+try {
+return {loadPtreeRoot.get("client_id"), 
loadPtreeRoot.get("client_secret")};
+} catch (const boost::property_tree::ptree_error& e) {
+ 

[pulsar-manager] branch master updated: The password can not be less than 6 digits (#414)

2021-09-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 8032347  The password can not be less than 6 digits (#414)
8032347 is described below

commit 803234712e7906885f2765f72407b99398b0c154
Author: 郭中奇 <16098391+g0715...@users.noreply.github.com>
AuthorDate: Thu Sep 9 10:12:00 2021 +0800

The password can not be less than 6 digits (#414)

Fixes #413

Master Issue: #413

Describe the modifications you've done.

When adding users to the /users/superuser interface, you need to add a 
password that is not less than 6 digits for verification, otherwise you cannot 
log in with a password less than 6 digits
---
 .../java/org/apache/pulsar/manager/service/impl/UsersServiceImpl.java | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/src/main/java/org/apache/pulsar/manager/service/impl/UsersServiceImpl.java 
b/src/main/java/org/apache/pulsar/manager/service/impl/UsersServiceImpl.java
index 1a69575..75b1608 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/UsersServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/UsersServiceImpl.java
@@ -52,6 +52,10 @@ public class UsersServiceImpl implements UsersService {
 validateResult.put("error", "Fields password and access token 
cannot be empty at the same time.");
 return validateResult;
 }
+if (userInfoEntity.getPassword().length() < 6) {
+validateResult.put("error", "The password can not be less than 6 
digits.");
+return validateResult;
+}
 validateResult.put("message", "Validate user success");
 return validateResult;
 }


[pulsar] branch master updated (bef3757 -> ac5114f)

2021-09-08 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from bef3757  Avoid to infinitely split bundle (#11937)
 add ac5114f  [pulsar-client]Add a optional params scope for pulsar oauth2 
client (#11931)

No new revisions were added by this update.

Summary of changes:
 .../auth/oauth2/AuthenticationFactoryOAuth2.java   |  18 
 .../impl/auth/oauth2/ClientCredentialsFlow.java|   9 +-
 .../protocol/ClientCredentialsExchangeRequest.java |   3 +
 .../impl/auth/oauth2/protocol/TokenClient.java |  54 +++---
 .../impl/auth/oauth2/protocol/TokenClientTest.java | 116 +
 5 files changed, 182 insertions(+), 18 deletions(-)
 create mode 100644 
pulsar-client/src/test/java/org/apache/pulsar/client/impl/auth/oauth2/protocol/TokenClientTest.java


[pulsar] branch master updated (3c406bc -> 15d2527)

2021-09-05 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 3c406bc  [C++] Move all C symbols into C++ pulsar namespace (#11919)
 add 15d2527  [website][upgrade] inject link plugin implement (#11929)

No new revisions were added by this update.

Summary of changes:
 site2/website-next/docs/schema-manage.md   |  62 ++---
 site2/website-next/docusaurus.config.js| 101 -
 site2/website-next/package.json|   3 +-
 site2/website-next/plugins/remark-linkify-regex.js |  85 +
 site2/website-next/scripts/migration.js|   4 +-
 .../versioned_docs/version-2.7.3/schema-manage.md  |  35 +--
 .../version-2.7.3/schema-understand.md |  15 ---
 .../versioned_docs/version-2.8.0/schema-manage.md  |  35 +--
 .../version-2.8.0/schema-understand.md |  18 
 9 files changed, 226 insertions(+), 132 deletions(-)
 create mode 100644 site2/website-next/plugins/remark-linkify-regex.js


[pulsar] branch master updated (58216d0 -> a5d2e2d)

2021-09-02 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 58216d0  [website][upgrade]feat: docs migration about Pulsar Schema 
(versions: next/2.8.0/2.7.3) (#11888)
 add a5d2e2d  [website][upgrade] add tabs supported (#11908)

No new revisions were added by this update.

Summary of changes:
 .../docs/schema-evolution-compatibility.md |   3 +
 site2/website-next/docs/schema-get-started.md  |   3 +
 site2/website-next/docs/schema-manage.md   | 142 +
 site2/website-next/docs/schema-understand.md   |  58 +++--
 site2/website-next/docusaurus.config.js|   1 +
 site2/website-next/scripts/fix-tab.js  |  85 
 site2/website-next/scripts/migration.js|   5 +-
 .../schema-evolution-compatibility.md  |   3 +
 .../version-2.7.3/schema-get-started.md|   3 +
 .../versioned_docs/version-2.7.3/schema-manage.md  | 142 +
 .../version-2.7.3/schema-understand.md |   3 +
 .../schema-evolution-compatibility.md  |   3 +
 .../version-2.8.0/schema-get-started.md|   3 +
 .../versioned_docs/version-2.8.0/schema-manage.md  | 142 +
 .../version-2.8.0/schema-understand.md |  58 +++--
 15 files changed, 549 insertions(+), 105 deletions(-)
 create mode 100644 site2/website-next/scripts/fix-tab.js


[pulsar] branch master updated (43b4ff6 -> 58216d0)

2021-09-02 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 43b4ff6  Fix deadlock caused by ExecutorService::close (#11882)
 add 58216d0  [website][upgrade]feat: docs migration about Pulsar Schema 
(versions: next/2.8.0/2.7.3) (#11888)

No new revisions were added by this update.

Summary of changes:
 .../docs/schema-evolution-compatibility.md | 210 ++--
 .../{ => website-next}/docs/schema-get-started.md  |   3 -
 site2/{ => website-next}/docs/schema-manage.md | 157 ---
 site2/{ => website-next}/docs/schema-understand.md | 150 +++
 site2/website-next/scripts/migration.js| 160 
 site2/website-next/sidebars.js |  28 +--
 site2/website-next/sidebars.json   |  39 
 .../schema-evolution-compatibility.md  | 211 ++---
 .../version-2.7.3}/schema-get-started.md   |   4 +-
 .../versioned_docs/version-2.7.3}/schema-manage.md | 159 
 .../version-2.7.3}/schema-understand.md| 113 +--
 .../schema-evolution-compatibility.md  | 211 ++---
 .../version-2.8.0}/schema-get-started.md   |   4 +-
 .../versioned_docs/version-2.8.0}/schema-manage.md | 159 
 .../version-2.8.0/schema-understand.md | 150 +++
 .../versioned_sidebars/version-2.7.3-sidebars.json |  24 +++
 .../versioned_sidebars/version-2.8.0-sidebars.json |  26 ++-
 17 files changed, 711 insertions(+), 1097 deletions(-)
 copy site2/{ => website-next}/docs/schema-evolution-compatibility.md (97%)
 copy site2/{ => website-next}/docs/schema-get-started.md (99%)
 copy site2/{ => website-next}/docs/schema-manage.md (94%)
 copy site2/{ => website-next}/docs/schema-understand.md (94%)
 create mode 100644 site2/website-next/scripts/migration.js
 create mode 100644 site2/website-next/sidebars.json
 copy site2/{docs => 
website-next/versioned_docs/version-2.7.3}/schema-evolution-compatibility.md 
(97%)
 copy site2/{docs => 
website-next/versioned_docs/version-2.7.3}/schema-get-started.md (99%)
 copy site2/{website/versioned_docs/version-2.7.1 => 
website-next/versioned_docs/version-2.7.3}/schema-manage.md (94%)
 copy site2/{website/versioned_docs/version-2.7.0 => 
website-next/versioned_docs/version-2.7.3}/schema-understand.md (96%)
 copy site2/{docs => 
website-next/versioned_docs/version-2.8.0}/schema-evolution-compatibility.md 
(97%)
 copy site2/{docs => 
website-next/versioned_docs/version-2.8.0}/schema-get-started.md (99%)
 copy site2/{website/versioned_docs/version-2.7.1 => 
website-next/versioned_docs/version-2.8.0}/schema-manage.md (94%)
 copy site2/{website => 
website-next}/versioned_docs/version-2.8.0/schema-understand.md (93%)


[pulsar] branch master updated: [website][upgrade] feat: initial framework (#11770)

2021-08-26 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 74b322c  [website][upgrade] feat: initial framework (#11770)
74b322c is described below

commit 74b322c7d6548cc4099cfbe43c3fa1e540071329
Author: Li Li 
AuthorDate: Fri Aug 27 09:17:00 2021 +0800

[website][upgrade] feat: initial framework (#11770)

### Motivation

website upgrade

### Modifications

Initial framework for website upgrade
---
 site2/.gitignore   |   2 +
 site2/website-next/.gitignore  |  22 ++
 site2/website-next/README.md   |  33 
 site2/website-next/babel.config.js |   3 +
 site2/website-next/blog/2021-08-25-welcome.md  |   7 ++
 site2/website-next/docs/intro.md   |   5 ++
 site2/website-next/docusaurus.config.js|  86 +
 site2/website-next/package.json|  40 ++
 site2/website-next/sidebars.js |  26 +++
 .../src/components/HomepageFeatures.js |  59 ++
 .../src/components/HomepageFeatures.module.css |  13 
 site2/website-next/src/css/custom.css  |  29 +++
 site2/website-next/src/pages/index.js  |  40 ++
 site2/website-next/src/pages/index.module.css  |  25 ++
 site2/website-next/src/pages/markdown-page.md  |   7 ++
 site2/website-next/static/.nojekyll|   0
 site2/website-next/static/img/favicon.ico  | Bin 0 -> 1150 bytes
 site2/website-next/static/img/logo.svg |   1 +
 18 files changed, 398 insertions(+)

diff --git a/site2/.gitignore b/site2/.gitignore
index bd5e769..f7825d3 100644
--- a/site2/.gitignore
+++ b/site2/.gitignore
@@ -14,3 +14,5 @@ website/static/swagger/master/*
 
 website/static/swagger/restApiVersions.json
 website/static/swagger/*/v*/*.json
+
+website-tmp*/
\ No newline at end of file
diff --git a/site2/website-next/.gitignore b/site2/website-next/.gitignore
new file mode 100644
index 000..50b6375
--- /dev/null
+++ b/site2/website-next/.gitignore
@@ -0,0 +1,22 @@
+# Dependencies
+/node_modules
+
+# Production
+/build
+build/
+# Generated files
+.docusaurus
+.cache-loader
+
+# Misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+bak/
\ No newline at end of file
diff --git a/site2/website-next/README.md b/site2/website-next/README.md
new file mode 100644
index 000..231a499
--- /dev/null
+++ b/site2/website-next/README.md
@@ -0,0 +1,33 @@
+# Website
+
+This website is built using [Docusaurus 2](https://docusaurus.io/), a modern 
static website generator.
+
+## Installation
+
+```console
+yarn install
+```
+
+## Local Development
+
+```console
+yarn start
+```
+
+This command starts a local development server and opens up a browser window. 
Most changes are reflected live without having to restart the server.
+
+## Build
+
+```console
+yarn build
+```
+
+This command generates static content into the `build` directory and can be 
served using any static contents hosting service.
+
+## Deployment
+
+```console
+GIT_USER= USE_SSH=true yarn deploy
+```
+
+If you are using GitHub pages for hosting, this command is a convenient way to 
build the website and push to the `gh-pages` branch.
diff --git a/site2/website-next/babel.config.js 
b/site2/website-next/babel.config.js
new file mode 100644
index 000..e00595d
--- /dev/null
+++ b/site2/website-next/babel.config.js
@@ -0,0 +1,3 @@
+module.exports = {
+  presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
+};
diff --git a/site2/website-next/blog/2021-08-25-welcome.md 
b/site2/website-next/blog/2021-08-25-welcome.md
new file mode 100644
index 000..00acf22
--- /dev/null
+++ b/site2/website-next/blog/2021-08-25-welcome.md
@@ -0,0 +1,7 @@
+---
+slug: welcome
+title: Welcome
+tags: [welcome, apache, pulsar]
+---
+
+Welcome to Apache Pulsar.
\ No newline at end of file
diff --git a/site2/website-next/docs/intro.md b/site2/website-next/docs/intro.md
new file mode 100644
index 000..95ef9d6
--- /dev/null
+++ b/site2/website-next/docs/intro.md
@@ -0,0 +1,5 @@
+---
+sidebar_position: 1
+---
+
+Welcome to Apache Pulsar.
\ No newline at end of file
diff --git a/site2/website-next/docusaurus.config.js 
b/site2/website-next/docusaurus.config.js
new file mode 100644
index 000..fe43a25
--- /dev/null
+++ b/site2/website-next/docusaurus.config.js
@@ -0,0 +1,86 @@
+const lightCodeTheme = require("prism-react-renderer/themes/github");
+const darkCodeTheme = require("prism-react-renderer/themes/dracula");
+
+/** @type {import('@docusaurus/types').DocusaurusConfig} */
+module.exports = {
+  title: &quo

[pulsar] branch master updated (061fb4b -> f893c08)

2021-08-19 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 061fb4b  [Build] Remove replace_maven-wagon-http-version.sh script 
which is obsolete with Maven 3.8.1+ (#11718)
 add f893c08  [Functions]Support protobuf schema for pulsar function 
(#11709)

No new revisions were added by this update.

Summary of changes:
 pulsar-functions/runtime-all/pom.xml| 17 +
 .../pulsar/functions/instance/JavaInstanceDepsTest.java |  3 +++
 2 files changed, 20 insertions(+)


[pulsar] branch master updated (98d7675 -> 4f9abf0)

2021-08-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 98d7675  [website][pulsar]: auto generate docs for pulsar subcommand: 
discovery (#11358)
 add 4f9abf0  [website][pulsar]: auto generate docs for pulsar subcommand: 
initialize-cluster-metadata (#11327)

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/pulsar/PulsarClusterMetadataSetup.java | 10 ++
 ...taTeardownTest.java => PulsarClusterMetadataSetupTest.java} |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/{PulsarClusterMetadataTeardownTest.java
 => PulsarClusterMetadataSetupTest.java} (92%)


[pulsar] branch master updated (6397699 -> 98d7675)

2021-08-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 6397699  [website][pulsar]: auto generate docs for pulsar subcommand: 
websocket (#11364)
 add 98d7675  [website][pulsar]: auto generate docs for pulsar subcommand: 
discovery (#11358)

No new revisions were added by this update.

Summary of changes:
 .../service/server/DiscoveryServiceStarter.java| 35 +-
 .../server/DiscoveryServiceStarterTest.java|  8 ++---
 2 files changed, 38 insertions(+), 5 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/PulsarInitialNamespaceSetupTest.java
 => 
pulsar-discovery-service/src/test/java/org/apache/pulsar/discovery/service/server/DiscoveryServiceStarterTest.java
 (88%)


[pulsar] branch master updated (cdf8bbb -> 6397699)

2021-08-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from cdf8bbb  [website][pulsar]: auto generate docs for pulsar subcommand: 
functions-worker (#11326)
 add 6397699  [website][pulsar]: auto generate docs for pulsar subcommand: 
websocket (#11364)

No new revisions were added by this update.

Summary of changes:
 .../websocket/service/WebSocketServiceStarter.java | 33 ++
 .../service/WebSocketServiceStarterTest.java   |  8 +++---
 2 files changed, 37 insertions(+), 4 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/PulsarClusterMetadataTeardownTest.java
 => 
pulsar-websocket/src/test/java/org/apache/pulsar/websocket/service/WebSocketServiceStarterTest.java
 (89%)


[pulsar] branch master updated (1fc7e3b -> cdf8bbb)

2021-08-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 1fc7e3b  [Issue #11523] Check the BrokerInterceptor before de-ref in 
newMessageAndIntercept (#11524)
 add cdf8bbb  [website][pulsar]: auto generate docs for pulsar subcommand: 
functions-worker (#11326)

No new revisions were added by this update.

Summary of changes:
 .../pulsar/functions/worker/FunctionWorkerStarter.java  | 13 +++--
 .../pulsar/functions/worker/FunctionWorkerStarterTest.java  | 11 ---
 2 files changed, 15 insertions(+), 9 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/PulsarVersionStarterTest.java => 
pulsar-functions/worker/src/test/java/org/apache/pulsar/functions/worker/FunctionWorkerStarterTest.java
 (86%)


[pulsar] branch master updated: [website][pulsar]: auto generate html for pulsar subcommands (#11365)

2021-07-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 026eac8  [website][pulsar]: auto generate html for pulsar subcommands 
(#11365)
026eac8 is described below

commit 026eac86c2c5a3858eb3bffc51f9669acaf13e4e
Author: Li Li 
AuthorDate: Thu Jul 29 13:38:12 2021 +0800

[website][pulsar]: auto generate html for pulsar subcommands (#11365)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
auto generate html for pulsar subcommands
---
 site2/tools/pulsar-doc-gen.sh  | 10 ++
 site2/website/brodocs/pulsar-manifest.json | 30 ++
 2 files changed, 40 insertions(+)

diff --git a/site2/tools/pulsar-doc-gen.sh b/site2/tools/pulsar-doc-gen.sh
index d64be66..2651788 100755
--- a/site2/tools/pulsar-doc-gen.sh
+++ b/site2/tools/pulsar-doc-gen.sh
@@ -32,6 +32,16 @@ $ROOT_DIR/bin/pulsar broker -g > 
$ROOT_DIR/site2/website/brodocs/documents/broke
 $ROOT_DIR/bin/pulsar broker-tool gen-doc > 
$ROOT_DIR/site2/website/brodocs/documents/broker-tool.md
 $ROOT_DIR/bin/pulsar compact-topic -t tmp -g > 
$ROOT_DIR/site2/website/brodocs/documents/compact-topic.md
 $ROOT_DIR/bin/pulsar tokens gen-doc > 
$ROOT_DIR/site2/website/brodocs/documents/tokens.md
+$ROOT_DIR/bin/pulsar proxy -g > 
$ROOT_DIR/site2/website/brodocs/documents/proxy.md
+$ROOT_DIR/bin/pulsar functions-worker -g > 
$ROOT_DIR/site2/website/brodocs/documents/functions-worker.md
+$ROOT_DIR/bin/pulsar standalone -g > 
$ROOT_DIR/site2/website/brodocs/documents/standalone.md
+$ROOT_DIR/bin/pulsar initialize-cluster-metadata -cs cs -uw uw -zk zk -c c -g 
> $ROOT_DIR/site2/website/brodocs/documents/initialize-cluster-metadata.md
+$ROOT_DIR/bin/pulsar delete-cluster-metadata -zk zk -g > 
$ROOT_DIR/site2/website/brodocs/documents/delete-cluster-metadata.md
+$ROOT_DIR/bin/pulsar initialize-transaction-coordinator-metadata -cs cs -c c 
-g > 
$ROOT_DIR/site2/website/brodocs/documents/initialize-transaction-coordinator-metadata.md
+$ROOT_DIR/bin/pulsar initialize-namespace -cs cs -c c -g demo > 
$ROOT_DIR/site2/website/brodocs/documents/initialize-namespace.md
+$ROOT_DIR/bin/pulsar version -g > 
$ROOT_DIR/site2/website/brodocs/documents/version.md
+$ROOT_DIR/bin/pulsar discovery -g > 
$ROOT_DIR/site2/website/brodocs/documents/discovery.md
+$ROOT_DIR/bin/pulsar websocket -g > 
$ROOT_DIR/site2/website/brodocs/documents/websocket.md
 
 cd $ROOT_DIR/site2/website/brodocs
 cp pulsar-manifest.json manifest.json
diff --git a/site2/website/brodocs/pulsar-manifest.json 
b/site2/website/brodocs/pulsar-manifest.json
index 586714e..6f4b73b 100644
--- a/site2/website/brodocs/pulsar-manifest.json
+++ b/site2/website/brodocs/pulsar-manifest.json
@@ -11,6 +11,36 @@
 },
 {
   "filename": "tokens.md"
+},
+{
+  "filename": "discovery.md"
+},
+{
+  "filename": "proxy.md"
+},
+{
+  "filename": "websocket.md"
+},
+{
+  "filename": "functions-worker.md"
+},
+{
+  "filename": "standalone.md"
+},
+{
+  "filename": "initialize-cluster-metadata.md"
+},
+{
+  "filename": "delete-cluster-metadata.md"
+},
+{
+  "filename": "initialize-transaction-coordinator-metadata.md"
+},
+{
+  "filename": "initialize-namespace.md"
+},
+{
+  "filename": "version.md"
 }
   ],
   "title": "Docs",


[pulsar] branch master updated (08698c6 -> 0ed823d)

2021-07-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 08698c6  [website][pulsar]: auto generate docs for pulsar subcommand: 
initialize-transaction-coordinator-metadata (#11360)
 add 0ed823d  [website][pulsar]: auto generate docs for pulsar subcommand: 
delete-cluster-metadata (#11328)

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/pulsar/PulsarClusterMetadataTeardown.java  | 10 ++
 ...taSetupTest.java => PulsarClusterMetadataTeardownTest.java} |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/{PulsarTransactionCoordinatorMetadataSetupTest.java
 => PulsarClusterMetadataTeardownTest.java} (88%)


[pulsar] branch master updated (d3c44ba -> 08698c6)

2021-07-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from d3c44ba  [stats] Do not expose meaningless stats for publisher (#11454)
 add 08698c6  [website][pulsar]: auto generate docs for pulsar subcommand: 
initialize-transaction-coordinator-metadata (#11360)

No new revisions were added by this update.

Summary of changes:
 .../PulsarTransactionCoordinatorMetadataSetup.java |  9 
 ...arTransactionCoordinatorMetadataSetupTest.java} | 24 +-
 2 files changed, 19 insertions(+), 14 deletions(-)
 copy 
pulsar-broker/src/test/java/org/apache/pulsar/{broker/tools/BrokerToolTest.java 
=> PulsarTransactionCoordinatorMetadataSetupTest.java} (80%)


[pulsar] branch master updated: [website][pulsar]: auto generate docs for pulsar subcommand: standalone (#11362)

2021-07-20 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 5ad4059  [website][pulsar]: auto generate docs for pulsar subcommand: 
standalone (#11362)
5ad4059 is described below

commit 5ad405988fabb4b28dbdbd5aa5c9a10802f39af1
Author: Li Li 
AuthorDate: Tue Jul 20 14:30:44 2021 +0800

[website][pulsar]: auto generate docs for pulsar subcommand: standalone 
(#11362)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
generate docs for pulsar subcommand: standalone
---
 .../main/java/org/apache/pulsar/PulsarStandaloneStarter.java   | 10 ++
 1 file changed, 10 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
index ac452b4..c764180 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
@@ -20,15 +20,19 @@ package org.apache.pulsar;
 
 import static org.apache.commons.lang3.StringUtils.isBlank;
 import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
 import java.io.FileInputStream;
 import java.util.Arrays;
 import org.apache.logging.log4j.LogManager;
 import org.apache.pulsar.broker.ServiceConfiguration;
 import org.apache.pulsar.common.configuration.PulsarConfigurationLoader;
+import org.apache.pulsar.common.util.CmdGenerateDocs;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PulsarStandaloneStarter extends PulsarStandalone {
+@Parameter(names = {"-g", "--generate-docs"}, description = "Generate 
docs")
+private boolean generateDocs = false;
 
 private static final Logger log = 
LoggerFactory.getLogger(PulsarStandaloneStarter.class);
 
@@ -42,6 +46,12 @@ public class PulsarStandaloneStarter extends 
PulsarStandalone {
 jcommander.usage();
 return;
 }
+if (this.generateDocs) {
+CmdGenerateDocs cmd = new CmdGenerateDocs("pulsar");
+cmd.addCommand("standalone", this);
+cmd.run(null);
+System.exit(0);
+}
 
 if (this.isNoBroker() && this.isOnlyBroker()) {
 log.error("Only one option is allowed between '--no-broker' 
and '--only-broker'");


[pulsar] branch master updated: [website][pulsar]generate html pages for pulsar command (#11232)

2021-07-09 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 04f9964  [website][pulsar]generate html pages for pulsar command 
(#11232)
04f9964 is described below

commit 04f9964cc4ea4e28b7ffeaae1a867909b1bcf792
Author: Li Li 
AuthorDate: Sat Jul 10 09:22:32 2021 +0800

[website][pulsar]generate html pages for pulsar command (#11232)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
generate html pages for pulsar command
---
 site2/tools/build-site.sh  |  1 +
 site2/tools/pulsar-doc-gen.sh  | 55 ++
 site2/website/brodocs/pulsar-manifest.json | 18 +++
 .../pages/en/{pulsar-perf-cli.js => pulsar-cli.js} |  6 +--
 site2/website/pages/en/pulsar-perf-cli.js  |  4 +-
 site2/website/static/js/custom.js  |  1 +
 site2/website/static/js/getCliByVersion.js |  3 ++
 7 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/site2/tools/build-site.sh b/site2/tools/build-site.sh
index da4ffda..7bd3bae 100755
--- a/site2/tools/build-site.sh
+++ b/site2/tools/build-site.sh
@@ -98,6 +98,7 @@ node ./scripts/split-swagger-by-version.js
 ${ROOT_DIR}/site2/tools/pulsar-admin-doc-gen.sh
 ${ROOT_DIR}/site2/tools/pulsar-client-doc-gen.sh
 ${ROOT_DIR}/site2/tools/pulsar-perf-doc-gen.sh
+${ROOT_DIR}/site2/tools/pulsar-doc-gen.sh
 cd ${ROOT_DIR}/site2/website
 
 rm -rf ${ROOT_DIR}/generated-site/content
diff --git a/site2/tools/pulsar-doc-gen.sh b/site2/tools/pulsar-doc-gen.sh
new file mode 100755
index 000..d64be66
--- /dev/null
+++ b/site2/tools/pulsar-doc-gen.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ROOT_DIR=$(git rev-parse --show-toplevel)
+VERSION=`${ROOT_DIR}/src/get-project-version.py`
+DEST_DIR=$ROOT_DIR/generated-site
+
+cd $ROOT_DIR
+
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules
+mkdir -p $ROOT_DIR/site2/website/brodocs/documents
+
+$ROOT_DIR/bin/pulsar broker -g > 
$ROOT_DIR/site2/website/brodocs/documents/broker.md
+$ROOT_DIR/bin/pulsar broker-tool gen-doc > 
$ROOT_DIR/site2/website/brodocs/documents/broker-tool.md
+$ROOT_DIR/bin/pulsar compact-topic -t tmp -g > 
$ROOT_DIR/site2/website/brodocs/documents/compact-topic.md
+$ROOT_DIR/bin/pulsar tokens gen-doc > 
$ROOT_DIR/site2/website/brodocs/documents/tokens.md
+
+cd $ROOT_DIR/site2/website/brodocs
+cp pulsar-manifest.json manifest.json
+node brodoc.js
+
+cp index.html $DEST_DIR/tools/pulsar/${VERSION}/
+cp navData.js stylesheet.css $DEST_DIR/tools/pulsar/${VERSION}/
+cp scroll.js tabvisibility.js $DEST_DIR/tools/pulsar/${VERSION}/
+cp favicon.ico $DEST_DIR/tools/pulsar/${VERSION}/
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules/bootstrap/dist/css
+cp -r 
$ROOT_DIR/site2/website/node_modules/bootstrap/dist/css/bootstrap.min.css 
$DEST_DIR/tools/pulsar/${VERSION}/node_modules/bootstrap/dist/css
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules/font-awesome/css
+cp -r 
$ROOT_DIR/site2/website/node_modules/font-awesome/css/font-awesome.min.css 
$DEST_DIR/tools/pulsar/${VERSION}/node_modules/font-awesome/css
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules/highlight.js/styles
+cp -r $ROOT_DIR/site2/website/node_modules/highlight.js/styles/default.css 
$DEST_DIR/tools/pulsar/${VERSION}/node_modules/highlight.js/styles
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules/jquery/dist
+cp -r $ROOT_DIR/site2/website/node_modules/jquery/dist/jquery.min.js 
$DEST_DIR/tools/pulsar/${VERSION}/node_modules/jquery/dist/
+mkdir -p $DEST_DIR/tools/pulsar/${VERSION}/node_modules/jquery.scrollto
+cp -r 
$ROOT_DIR/site2/website/node_modules/jquery.scrollto/jquery.scrollTo.min.js 
$DEST_DIR/tools/pulsar/${VERSION}/node_modules/jquery.scrollto
+
+
diff --git a/site2/website/brodocs/pulsar-man

[pulsar] branch master updated: [website][pulsar]generate docs for pulsar subcommand: tokens (#11231)

2021-07-09 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 00268c3  [website][pulsar]generate docs for pulsar subcommand: tokens 
(#11231)
00268c3 is described below

commit 00268c39cc8c9ed8407ad2afd2a1096734658230
Author: Li Li 
AuthorDate: Fri Jul 9 14:40:23 2021 +0800

[website][pulsar]generate docs for pulsar subcommand: tokens (#11231)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
generate docs for pulsar subcommand - tokens
---
 .../pulsar/utils/auth/tokens/TokensCliUtils.java   |  7 ++
 .../utils/auth/tokens/TokensCliUtilsTest.java  | 84 ++
 2 files changed, 91 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
index ee2c384..bbf9d9f 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
@@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit;
 import javax.crypto.SecretKey;
 import lombok.Cleanup;
 import org.apache.pulsar.broker.authentication.utils.AuthTokenUtils;
+import org.apache.pulsar.common.util.CmdGenerateDocs;
 import org.apache.pulsar.common.util.RelativeTimeUtil;
 
 public class TokensCliUtils {
@@ -303,6 +304,8 @@ public class TokensCliUtils {
 CommandValidateToken commandValidateToken = new CommandValidateToken();
 jcommander.addCommand("validate", commandValidateToken);
 
+jcommander.addCommand("gen-doc", new Object());
+
 try {
 jcommander.parse(args);
 
@@ -329,6 +332,10 @@ public class TokensCliUtils {
 commandShowToken.run();
 } else if (cmd.equals("validate")) {
 commandValidateToken.run();
+} else if (cmd.equals("gen-doc")) {
+CmdGenerateDocs genDocCmd = new CmdGenerateDocs("pulsar");
+genDocCmd.addCommand("tokens", jcommander);
+genDocCmd.run(null);
 } else {
 System.err.println("Invalid command: " + cmd);
 System.exit(1);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtilsTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtilsTest.java
new file mode 100644
index 000..bca2094
--- /dev/null
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtilsTest.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.utils.auth.tokens;
+
+import static org.testng.Assert.assertTrue;
+import com.beust.jcommander.Parameter;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import org.testng.annotations.Test;
+
+/**
+ * TokensCliUtils Tests.
+ */
+public class TokensCliUtilsTest {
+
+/**
+ * Test tokens generate docs.
+ *
+ * @throws Exception
+ */
+@Test
+public void testGenerateDocs() throws Exception {
+PrintStream oldStream = System.out;
+try {
+ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
+System.setOut(new PrintStream(baoStream));
+
+TokensCliUtils.main(new String[]{"gen-doc"});
+
+String message = baoStream.toString();
+
+String[] innerClassList = {
+TokensCliUtils.CommandCreateSecretKey.class.getName(),
+TokensCliUtils.CommandCreateKeyPair.class.getName(),
+TokensCliUtils.CommandCreateToken.class.getName(),
+TokensCliUtils.CommandShowToken.class.getName(),
+  

[pulsar] branch master updated: [website][pulsar]generate docs for pulsar subcommand: compact-topic (#11230)

2021-07-09 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 37c5e17  [website][pulsar]generate docs for pulsar subcommand: 
compact-topic (#11230)
37c5e17 is described below

commit 37c5e179c6254da8121d483910d37892c278139d
Author: Li Li 
AuthorDate: Fri Jul 9 14:38:31 2021 +0800

[website][pulsar]generate docs for pulsar subcommand: compact-topic (#11230)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
generate docs for pulsar subcommand: compact-topic
---
 .../apache/pulsar/compaction/CompactorTool.java| 11 
 .../pulsar/compaction/CompactorToolTest.java   | 75 ++
 2 files changed, 86 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java
index ee2b374..ff01a1d 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorTool.java
@@ -39,6 +39,7 @@ import org.apache.pulsar.broker.ServiceConfigurationUtils;
 import org.apache.pulsar.client.api.ClientBuilder;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.common.configuration.PulsarConfigurationLoader;
+import org.apache.pulsar.common.util.CmdGenerateDocs;
 import org.apache.pulsar.common.util.netty.EventLoopUtil;
 import org.apache.pulsar.zookeeper.ZooKeeperClientFactory;
 import org.apache.pulsar.zookeeper.ZookeeperBkClientFactoryImpl;
@@ -57,6 +58,9 @@ public class CompactorTool {
 
 @Parameter(names = {"-h", "--help"}, description = "Show this help 
message")
 private boolean help = false;
+
+@Parameter(names = {"-g", "--generate-docs"}, description = "Generate 
docs")
+private boolean generateDocs = false;
 }
 
 public static void main(String[] args) throws Exception {
@@ -71,6 +75,13 @@ public class CompactorTool {
 System.exit(-1);
 }
 
+if (arguments.generateDocs) {
+CmdGenerateDocs cmd = new CmdGenerateDocs("pulsar");
+cmd.addCommand("compact-topic", arguments);
+cmd.run(null);
+System.exit(-1);
+}
+
 // init broker config
 ServiceConfiguration brokerConfig;
 if (isBlank(arguments.brokerConfigFile)) {
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorToolTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorToolTest.java
new file mode 100644
index 000..795cf2b
--- /dev/null
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorToolTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.compaction;
+
+import static org.testng.Assert.assertTrue;
+import com.beust.jcommander.Parameter;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import org.apache.pulsar.common.util.CmdGenerateDocs;
+import org.testng.annotations.Test;
+
+/**
+ * CompactorTool Tests.
+ */
+public class CompactorToolTest {
+
+/**
+ * Test broker-tool generate docs
+ *
+ * @throws Exception
+ */
+@Test
+public void testGenerateDocs() throws Exception {
+PrintStream oldStream = System.out;
+try {
+ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
+System.setOut(new PrintStream(baoStream));
+
+Class argumentsClass = 
Class.forName("org.apache.pulsar.compaction.CompactorTool$Arguments");
+
+Constructor constructor = argumentsClass.getDeclared

[pulsar] branch master updated (77e92f7 -> eaac676)

2021-07-09 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 77e92f7  fix ex typo (#11245)
 add eaac676  [website][pulsar][broker]generate docs for pulsar subcommand 
- broker (#11228)

No new revisions were added by this update.

Summary of changes:
 .../org/apache/pulsar/PulsarBrokerStarter.java | 15 +++-
 .../org/apache/pulsar/PulsarBrokerStarterTest.java | 42 +-
 2 files changed, 55 insertions(+), 2 deletions(-)


[pulsar] branch master updated: fix: pulsar-client and pulsar-perf cli doc command flag duplicated (#11182)

2021-07-06 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 4cbae56  fix: pulsar-client and pulsar-perf cli doc command flag 
duplicated (#11182)
4cbae56 is described below

commit 4cbae56523f903bd8f38c1ec4fb4f9d1580fb53b
Author: Li Li 
AuthorDate: Wed Jul 7 11:37:47 2021 +0800

fix: pulsar-client and pulsar-perf cli doc command flag duplicated (#11182)

### Master Issue: #10040

### Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
fix duplicated long and short command line parameter names for 
pulsar-client cli docs
fix duplicated long and short command line parameter names for pulsar-perf 
cli docs
---
 .../pulsar/client/cli/CmdGenerateDocumentation.java | 17 ++---
 .../pulsar/testclient/CmdGenerateDocumentation.java | 17 ++---
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java
 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java
index 9a7a80a..c9e44f3 100644
--- 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java
+++ 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdGenerateDocumentation.java
@@ -79,17 +79,12 @@ public class CmdGenerateDocumentation {
 }
 sb.append("|Flag|Description|Default|\n");
 sb.append("|---|---|---|\n");
-// IKey is an internal interface and cannot be accessed directly,
-// so the type needs to be erased and force cast to a subclass
-Map descriptionMap = cmd.getDescriptions();
-descriptionMap.forEach((k, v) -> {
-StringKey key = (StringKey) k;
-ParameterDescription description = (ParameterDescription) v;
-sb.append("| `").append(key.getName())
-.append("` | 
").append(description.getDescription().replace("\n", " "))
-
.append("|").append(description.getDefault()).append("|\n");
-
-});
+List options = cmd.getParameters();
+options.forEach((option) ->
+sb.append("| `").append(option.getNames())
+.append("` | 
").append(option.getDescription().replace("\n", " "))
+.append("|").append(option.getDefault()).append("|\n")
+);
 System.out.println(sb.toString());
 return sb.toString();
 }
diff --git 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java
 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java
index 03a1029..40b02cf 100644
--- 
a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java
+++ 
b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/CmdGenerateDocumentation.java
@@ -109,17 +109,12 @@ public class CmdGenerateDocumentation {
 }
 sb.append("|Flag|Description|Default|\n");
 sb.append("|---|---|---|\n");
-// IKey is an internal interface and cannot be accessed directly,
-// so the type needs to be erased and force cast to a subclass
-Map descriptionMap = cmd.getDescriptions();
-descriptionMap.forEach((k, v) -> {
-StringKey key = (StringKey) k;
-ParameterDescription description = (ParameterDescription) v;
-sb.append("| `").append(key.getName())
-.append("` | 
").append(description.getDescription().replace("\n", " "))
-
.append("|").append(description.getDefault()).append("|\n");
-
-});
+List options = cmd.getParameters();
+options.forEach((option) ->
+sb.append("| `").append(option.getNames())
+.append("` | 
").append(option.getDescription().replace("\n", " "))
+.append("|").append(option.getDefault()).append("|\n")
+);
 System.out.println(sb.toString());
 return sb.toString();
 }


[pulsar] branch master updated: [website][common]common util for generate docs (#11225)

2021-07-06 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 fbd8d6b  [website][common]common util for generate docs (#11225)
fbd8d6b is described below

commit fbd8d6bd13188d7b396b689c084d4d7177acb720
Author: Li Li 
AuthorDate: Wed Jul 7 10:08:40 2021 +0800

[website][common]common util for generate docs (#11225)

### Master Issue: #10040
Motivation
Support auto generate HTML page for pulsar client cli tool, for example: 
https://github.com/apache/pulsar/tree/asf-site/content/tools/pulsar-admin

### Modifications
common util for generate docs
---
 pulsar-common/pom.xml  |   4 +
 .../apache/pulsar/common/util/CmdGenerateDocs.java | 169 +
 .../pulsar/common/util/CmdGenerateDocsTest.java| 107 +
 3 files changed, 280 insertions(+)

diff --git a/pulsar-common/pom.xml b/pulsar-common/pom.xml
index 23bf23a..225c260 100644
--- a/pulsar-common/pom.xml
+++ b/pulsar-common/pom.xml
@@ -188,6 +188,10 @@
   gson
   
 
+
+  com.beust
+  jcommander
+
   
 
   
diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
 
b/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
new file mode 100644
index 000..9c656be
--- /dev/null
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
@@ -0,0 +1,169 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.util;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.ParameterDescription;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@Parameters(commandDescription = "Generate documentation automatically.")
+public class CmdGenerateDocs {
+
+@Parameter(
+names = {"-h", "--help"},
+description = "Display help information"
+)
+public boolean help;
+
+@Parameter(
+names = {"-n", "--command-names"},
+description = "List of command names"
+)
+private List commandNames = new ArrayList<>();
+
+private static final String name = "gen-doc";
+private final JCommander jcommander;
+
+public CmdGenerateDocs(String cmdName) {
+jcommander = new JCommander(this);
+jcommander.setProgramName(cmdName);
+}
+
+public CmdGenerateDocs addCommand(String name, Object command) {
+jcommander.addCommand(name, command);
+return this;
+}
+
+public boolean run(String[] args) {
+JCommander tmpCmd = new JCommander(this);
+tmpCmd.setProgramName(jcommander.getProgramName() + " " + name);
+try {
+if (args == null) {
+args = new String[]{};
+}
+tmpCmd.parse(args);
+} catch (Exception e) {
+System.err.println(e.getMessage());
+System.err.println();
+tmpCmd.usage();
+return false;
+}
+if (help) {
+tmpCmd.usage();
+return true;
+}
+
+if (commandNames.size() == 0) {
+for (Map.Entry cmd : 
jcommander.getCommands().entrySet()) {
+if (cmd.getKey().equals(name)) {
+continue;
+}
+System.out.println(generateDocument(cmd.getKey(), jcommander));
+}
+} else {
+for (String commandName : commandNames) {
+if (commandName.equals(name)) {
+continue;
+}
+if (!jcommander.getCommands().keySet().contains(commandName)) {
+continue;
+}
+System.out.println(generateDocument(commandName, jcomm

[pulsar] branch master updated (ce6be12 -> ad01fc9)

2021-07-05 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from ce6be12  [Broker] Fix broker dispatch byte rate limiter. (#11135)
 add ad01fc9  fix deserializeBrokerEntryMetaDataFirst not found (#11220)

No new revisions were added by this update.

Summary of changes:
 .../org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)


[pulsar] branch master updated (e8b773e -> b5692dd)

2021-07-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from e8b773e  [feat][website] add local debugging tools shell for website 
(#11160)
 add b5692dd  [website][pulsar-perf] Support auto generate html page for 
pulsar perf cli tool (#11169)

No new revisions were added by this update.

Summary of changes:
 .../testclient/CmdGenerateDocumentation.java   |  1 -
 site2/tools/build-site.sh  |  1 +
 ...ar-client-doc-gen.sh => pulsar-perf-doc-gen.sh} | 36 +++---
 ...ent-manifest.json => pulsar-perf-manifest.json} |  2 +-
 site2/website/brodocs/stylesheet.css   |  4 ++-
 .../{pulsar-client-cli.js => pulsar-perf-cli.js}   | 10 +++---
 site2/website/static/js/custom.js  |  3 +-
 site2/website/static/js/getCliByVersion.js |  3 ++
 8 files changed, 33 insertions(+), 27 deletions(-)
 copy site2/tools/{pulsar-client-doc-gen.sh => pulsar-perf-doc-gen.sh} (51%)
 copy site2/website/brodocs/{pulsar-client-manifest.json => 
pulsar-perf-manifest.json} (76%)
 copy site2/website/pages/en/{pulsar-client-cli.js => pulsar-perf-cli.js} (60%)


[pulsar] branch master updated (6f29bb8 -> e8b773e)

2021-07-01 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 6f29bb8  [Tests] Fixed copy-paste error in the test (#11176)
 add e8b773e  [feat][website] add local debugging tools shell for website 
(#11160)

No new revisions were added by this update.

Summary of changes:
 docker/get-version.sh => site2/tools/debug-site.sh | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)
 copy docker/get-version.sh => site2/tools/debug-site.sh (74%)


[pulsar] branch master updated (a48b725 -> 706eae79)

2021-06-29 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from a48b725  Fix the timestamp description for resetCursor (#11121)
 add 706eae79 fix: pulsar admin/client cli docs jump incorrect (#11151)

No new revisions were added by this update.

Summary of changes:
 site2/website/static/js/getCliByVersion.js | 21 -
 1 file changed, 8 insertions(+), 13 deletions(-)


[pulsar-manager] branch master updated: Multi bookie cluster Support (#388)

2021-06-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2b0671a  Multi bookie cluster Support (#388)
2b0671a is described below

commit 2b0671aaa30af1df81b9c13ac0d151f8a9992fea
Author: 郭中奇 <16098391+g0715...@users.noreply.github.com>
AuthorDate: Tue Jun 22 10:17:41 2021 +0800

Multi bookie cluster Support (#388)

Fixes #387

Master Issue: #387

*Describe the modifications you've done.*

Support multi-bookie cluster, no longer use the address configured in the 
application.properties file
---
 docker/init_db.sql |   1 +
 front-end/src/lang/en.js   |   6 +
 front-end/src/lang/zh.js   |   6 +
 .../src/views/management/environments/index.vue| 337 +++--
 .../pulsar/manager/PulsarApplicationListener.java  |   8 +-
 .../pulsar/manager/entity/EnvironmentEntity.java   |   1 +
 .../pulsar/manager/mapper/EnvironmentsMapper.java  |  14 +-
 .../manager/service/EnvironmentCacheService.java   |   6 +
 .../manager/service/impl/BookiesServiceImpl.java   |  28 +-
 .../manager/service/impl/DashboardServiceImpl.java |   2 +-
 .../service/impl/EnvironmentCacheServiceImpl.java  |  33 +-
 src/main/resources/META-INF/sql/herddb-schema.sql  |   3 +-
 src/main/resources/META-INF/sql/mysql-schema.sql   |   1 +
 .../resources/META-INF/sql/postgresql-schema.sql   |   1 +
 src/main/resources/META-INF/sql/sqlite-schema.sql  |   1 +
 src/main/resources/application.properties  |   2 +-
 .../dao/EnvironmentsRepositoryImplTest.java|   3 +
 .../manager/service/BookiesServiceImplTest.java|  12 +-
 .../manager/service/DashboardServiceImplTest.java  |   2 +-
 .../service/EnvironmentCacheServiceImplTest.java   |   3 +
 20 files changed, 274 insertions(+), 196 deletions(-)

diff --git a/docker/init_db.sql b/docker/init_db.sql
index 42314d7..5dcf3bd 100644
--- a/docker/init_db.sql
+++ b/docker/init_db.sql
@@ -21,6 +21,7 @@ GRANT ALL PRIVILEGES ON DATABASE pulsar_manager to pulsar;
 CREATE TABLE IF NOT EXISTS environments (
   name varchar(256) NOT NULL,
   broker varchar(1024) NOT NULL,
+  bookie varchar(1024) NOT NULL,
   CONSTRAINT PK_name PRIMARY KEY (name),
   UNIQUE (broker)
 );
diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index f2c974f..6e359da 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -664,6 +664,7 @@ export default {
 deleteClusterSuccessNotification: 'Successfully delete a cluster',
 clusterNameIsRequired: 'Cluster name is required',
 serviceUrlIsRequired: 'Service URL is required',
+bookieUrlIsRequired: 'Bookie URL is required',
 deleteClusterDialogCaption: 'Delete Cluster',
 updateClusterSuccessNotification: 'Successfully update a cluster'
   },
@@ -751,6 +752,7 @@ export default {
 buttonNewEnv: 'New Environment',
 colHeadingEnv: 'Environment Name',
 colHeadingServiceUrl: 'Service URL',
+colHeadingBookieUrl: 'Bookie URL',
 newEnvDialogCaption: 'New Environment',
 newEnvNamePlaceHolder: 'Please input environment name',
 newEnvNameLabel: 'Environment Name',
@@ -759,7 +761,11 @@ export default {
 updateEnvDialogCaption: 'Update Environment',
 updateEnvNameLabel: 'Environment Name',
 updateEnvServiceUrlPlaceHolder: 'Please input environment service url',
+updateEnvBookieUrlPlaceHolder: 'Please input environment bookie url',
+newEnvBookieUrlPlaceHolder: 'Please input environment bookie url',
 updateEnvServiceUrlLabel: 'Service URL',
+updateEnvBookieUrlLabel: 'Bookie URL',
+newEnvBookieUrlLabel: 'Bookie URL',
 deleteEnvDialogCaption: 'Delete Environment',
 deleteEnvDialogText: 'Are you sure you want to delete this environment?',
 envNameIsRequired: 'Environment Name is required',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index db9b299..d466f8b 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -662,6 +662,7 @@ export default {
 deleteClusterSuccessNotification: 'Successfully delete a cluster',
 clusterNameIsRequired: 'Cluster name is required',
 serviceUrlIsRequired: 'Service URL is required',
+bookieUrlIsRequired: 'Bookie URL is required',
 deleteClusterDialogCaption: 'Delete Cluster',
 updateClusterSuccessNotification: 'Successfully update a cluster'
   },
@@ -749,15 +750,20 @@ export default {
 buttonNewEnv: 'New Environment',
 colHeadingEnv: 'Environment Name',
 colHeadingServiceUrl: 'Service URL',
+colHeadingBookieUrl: 'Bookie URL',
 newEnvDialogCaption: 'New Environment',
 newEnvNamePlaceHolder: 'Please input environment name',
 newEnvNameLabel: 'Environment Name',
 newEnvServiceUrlPlaceHolder: 'Please input environment servi

[pulsar-manager] branch master updated (46f9e0a -> 9d9c52e)

2021-06-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 46f9e0a  Upgrade to java 1.8.0_292 (#398)
 add 9d9c52e  Fixed the bug that admin roles cannot be deleted. (#397)

No new revisions were added by this update.

Summary of changes:
 front-end/src/views/management/tenants/tenant.vue | 1 +
 1 file changed, 1 insertion(+)


[pulsar-manager] branch master updated (4796f0c -> 46f9e0a)

2021-06-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 4796f0c  Use the Apache Pulsar Helm chart (#384)
 add 46f9e0a  Upgrade to java 1.8.0_292 (#398)

No new revisions were added by this update.

Summary of changes:
 .dockerignore|  4 
 docker/Dockerfile| 10 --
 docker/entrypoint.sh |  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)
 create mode 100644 .dockerignore


[pulsar-manager] branch master updated (09a9781 -> 8eb98c9)

2021-05-26 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 09a9781  fix unload namespace error (#386)
 add 8eb98c9  fix ISSUE-390: Pulsar manager successfully added the 
administrator account with password "admin", but the web login password can not 
be less than 6 digits. (#393)

No new revisions were added by this update.

Summary of changes:
 README.md | 1 +
 1 file changed, 1 insertion(+)


[pulsar-manager] branch master updated: Use the Apache Pulsar Helm chart (#384)

2021-05-26 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4796f0c  Use the Apache Pulsar Helm chart (#384)
4796f0c is described below

commit 4796f0cc80331a0140ea047ba0b07787340e75c1
Author: Michael Marshall 
AuthorDate: Wed May 26 05:55:37 2021 -0600

Use the Apache Pulsar Helm chart (#384)

### Motivation

In reading through the `pulsar-manager` documentation, I noticed that the 
README points to the StreamNative helm chart. I believe this is likely because 
the StreamNative helm chart predated the Apache one. I'm unfamiliar with the 
differences between these two charts, but I would think that this project 
should point to the official Apache Pulsar helm chart. If that assumption is 
wrong, please let me know.

### Modifications

Reference the official Apache Pulsar Helm chart, instead.

### Verifying this change

Followed the directions in https://github.com/apache/pulsar-helm-chart, 
which are pretty much the same as https://github.com/streamnative/charts.
---
 README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 479faab..e1e2f6b 100644
--- a/README.md
+++ b/README.md
@@ -85,14 +85,14 @@ Alternatively, you can start a standalone and Pulsar 
Manager using the docker co
 
 ### Deploy Pulsar Manager to Kubernetes
 
-The Pulsar Manager can be deployed as part of [Pulsar Helm 
Chart](https://github.com/streamnative/charts).
+The Pulsar Manager can be deployed as part of [Pulsar Helm 
Chart](https://github.com/apache/pulsar-helm-chart).
 
 1. Install the Pulsar cluster with Pulsar Manager
 
 ```bash
-helm repo add streamnative https://charts.streamnative.io
+helm repo add apache https://pulsar.apache.org/charts
 helm repo update
-helm install  streamnative/pulsar
+helm install  apache/pulsar
 ```
 
 2. Access the Pulsar Manager.


[pulsar-manager] branch master updated (cebbcce -> 09a9781)

2021-05-24 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from cebbcce  Upgrade Athenz version and remove yahoo.bintray.com 
repository (#379)
 add 09a9781  fix unload namespace error (#386)

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/pulsar/manager/dao/NamespacesRepositoryImpl.java  | 4 
 1 file changed, 4 insertions(+)


[pulsar] branch master updated (f807fed -> 2bd614a)

2021-05-21 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from f807fed  Issue 6478: Fix the misleading setting in presto 
configuration (#8549)
 add 2bd614a  feat: update website docker image (#10678)

No new revisions were added by this update.

Summary of changes:
 site2/tools/docker-build-site.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[pulsar-manager] branch master updated: [Offload] Add offload threshold input (#375)

2021-03-25 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2cffa68  [Offload] Add offload threshold input (#375)
2cffa68 is described below

commit 2cffa68d3d9aebe77f8652abe30c447567ff57d3
Author: ran 
AuthorDate: Thu Mar 25 20:11:07 2021 +0800

[Offload] Add offload threshold input (#375)

Fixes #374

### Motivation

Currently, the offload operation lacks the offload threshold.

### Modifications

Add the offload threshold input for the offload operation.

### Verifying this change

- [ ] Make sure that the change passes the `./gradlew build` checks.
---
 front-end/src/lang/en.js|   6 +-
 front-end/src/lang/zh.js|   6 +-
 front-end/src/utils/validate.js |  25 ++
 front-end/src/views/management/topics/topic.vue | 113 +++-
 4 files changed, 125 insertions(+), 25 deletions(-)

diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index 23f566e..f2c974f 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -619,11 +619,15 @@ export default {
   unloadTopicSuccess: 'Successfully unload the topic!',
   terminateTopicSuccess: 'Successfully terminate the topic!',
   startCompactionSuccess: 'Successfully start compacting the topic!',
-  startOffloadSuccess: 'Successfully start offloading the topic!',
+  startOffloadSuccess: 'Successfully start offloading the topic',
   expireMessageSuccess: 'Successfully expire messages the topic!',
   resetMessageSuccess: 'Successfully reset messages the topic!',
   clearMessageSuccess: 'Successfully clear messages the topic'
 },
+errorLog: {
+  noOffloadData: 'Nothing to offload!',
+  invalidSizeStr: 'Invalid size string! (e.g 200K 50M 1G)'
+},
 info: 'INFO',
 column: 'column',
 data: 'data',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index bbec239..db9b299 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -619,9 +619,13 @@ export default {
   unloadTopicSuccess: 'Successfully unload the topic!',
   terminateTopicSuccess: 'Successfully terminate the topic!',
   startCompactionSuccess: 'Successfully start compacting the topic!',
-  startOffloadSuccess: 'Successfully start offloading the topic!',
+  startOffloadSuccess: 'Successfully start offloading the topic',
   expireMessageSuccess: 'Successfully expire messages the topic!'
 },
+errorLog: {
+  noOffloadData: 'Nothing to offload!',
+  invalidSizeStr: 'Invalid size string! (e.g 200K 50M 1G)'
+},
 info: 'INFO',
 column: 'column',
 data: 'data',
diff --git a/front-end/src/utils/validate.js b/front-end/src/utils/validate.js
index c45458a..751bb12 100644
--- a/front-end/src/utils/validate.js
+++ b/front-end/src/utils/validate.js
@@ -86,3 +86,28 @@ export function validateServiceUrl(expectedProtocol, 
allowEmpty) {
 }
   }
 }
+
+export function validateSizeString(str) {
+  var last = str.charAt(str.length - 1)
+  var subStr = str.substring(0, str.length - 1)
+  switch (last) {
+case 'k':
+case 'K':
+  return Number(subStr) * 1024
+
+case 'm':
+case 'M':
+  return Number(subStr) * 1024 * 1024
+
+case 'g':
+case 'G':
+  return Number(subStr) * 1024 * 1024 * 1024
+
+case 't':
+case 'T':
+  return Number(subStr) * 1024 * 1024 * 1024 * 1024
+
+default:
+  return Number(str)
+  }
+}
diff --git a/front-end/src/views/management/topics/topic.vue 
b/front-end/src/views/management/topics/topic.vue
index 1d211c9..f45b53b 100644
--- a/front-end/src/views/management/topics/topic.vue
+++ b/front-end/src/views/management/topics/topic.vue
@@ -185,23 +185,29 @@
 class="circle">
 {{ offload }}
   
-  
-{{ $t('topic.offload') }}
-  
-  
-{{ $t('topic.offload') }}
-  
+  
+
+  
+{{ $t('topic.offload') }}
+  
+
+
+  
+
+  
+
+  
 
   
 
@@ -554,6 +560,7 @@ import Pagination from '@/components/Pagination' // 
Secondary package based on e
 import { formatBytes } from '@/utils/index'
 import { numberFormatter } from '@/filters/index'
 import { putSubscriptionOnCluster, deleteSubscriptionOnCluster } from 
'@/api/subscriptions'
+import { validateSizeString } from '@/utils/validate'
 
 const defaultForm = {
   persistent: '',
@@ -645,7 +652,9 @@ export default {
   routeTopic: '',
   routeTopic

[pulsar-manager] branch master updated: 362 fix retention size label (#372)

2021-01-24 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 9308143  362 fix retention size label (#372)
9308143 is described below

commit 9308143abc145e5cbc0df491a3b35baf8a9e579e
Author: leo-vie <77278890+leo-...@users.noreply.github.com>
AuthorDate: Mon Jan 25 04:58:36 2021 +0100

362 fix retention size label (#372)

Fixes #362


### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 front-end/src/lang/en.js | 2 +-
 front-end/src/lang/zh.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index 3e87161..23f566e 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -407,7 +407,7 @@ export default {
   messageTTLContent: 'Set message TTL in seconds. If the messages are not 
consumed by any consumers' +
 ' of a subscription, they are marked as `consumed` after the 
configured TTL period for that subscription.',
   inputMessageTTL: 'Please input Backlog Quotas Limit',
-  retentionSize: 'Retention Size (bytes)',
+  retentionSize: 'Retention Size (megabytes)',
   retentionSizeContent: 'The retention size. Only applied to the messages 
are acknowledged by all subscriptions.',
   inputRententionSize: 'Please input retention size',
   retentionTime: 'Retention Period (minutes)',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index 304ddd0..bbec239 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -407,7 +407,7 @@ export default {
   messageTTLContent: 'Set message TTL in seconds. If the messages are not 
consumed by any consumers' +
 ' of a subscription, they are marked as `consumed` after the 
configured TTL period for that subscription.',
   inputMessageTTL: 'Please input Backlog Quotas Limit',
-  retentionSize: 'Retention Size (bytes)',
+  retentionSize: 'Retention Size (megabytes)',
   retentionSizeContent: 'The retention size. Only applied to the messages 
are acknowledged by all subscriptions.',
   inputRententionSize: 'Please input retention size',
   retentionTime: 'Retention Period (minutes)',



[pulsar] branch master updated (752319e -> afe6af2)

2021-01-05 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 752319e  Fix unload namespaces bundle hangs. (#9116)
 add afe6af2  Fixed curl call response (#9115)

No new revisions were added by this update.

Summary of changes:
 .../pulsar/functions/worker/rest/api/v3/FunctionsApiV3Resource.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



[pulsar-manager] branch master updated: fix ISSUE-361: Pulsar manager's swagger dose not work. (#369)

2020-12-28 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 8971dfe  fix ISSUE-361: Pulsar manager's swagger dose not work. (#369)
8971dfe is described below

commit 8971dfe64548b52726e455dd3bd5ed30e28a60cf
Author: yixin 
AuthorDate: Tue Dec 29 14:02:29 2020 +0800

fix ISSUE-361: Pulsar manager's swagger dose not work. (#369)

Fixes #ISSUE-361

### Motivation
Pulsar manager's swagger does not work, so I try to fix this issue.

### Modifications
1. Swagger urls can't be accessed because the interceptors  blocked them, 
so I modified the interceptors to allow swagger urls.
2. I added a swagger configration in `application.properties`, thus, if you 
want to use swagger in development environment, you can set the value `true`. 
And  if you don't want to enable swagger in production environment, you can set 
the value `false`.
3. I modified the `SwaggerConfig` class, because swagger need some 
authorization infomation, otherwise it will receive 401 code in response header.
4. I modified the README.md to show how to use swagger, and added some 
images in docs.
5. Now the swagger can work correctly.

### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 docs/img/swagger-authorize.png | Bin 0 -> 58136 bytes
 docs/img/swagger-request-login.png | Bin 0 -> 136031 bytes
 src/README.md  |  31 +
 .../manager/interceptor/WebAppConfigurer.java  |   9 
 .../pulsar/manager/swagger/SwaggerConfig.java  |  48 -
 src/main/resources/application.properties  |   3 ++
 6 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/docs/img/swagger-authorize.png b/docs/img/swagger-authorize.png
new file mode 100644
index 000..a7b3042
Binary files /dev/null and b/docs/img/swagger-authorize.png differ
diff --git a/docs/img/swagger-request-login.png 
b/docs/img/swagger-request-login.png
new file mode 100644
index 000..a54bd99
Binary files /dev/null and b/docs/img/swagger-request-login.png differ
diff --git a/src/README.md b/src/README.md
index 301d9a6..2fbc0b6 100644
--- a/src/README.md
+++ b/src/README.md
@@ -187,6 +187,37 @@ Set the `bkvm.enabled` field to `true` in the file 
[bkvm.conf](https://github.co
 apachepulsar/pulsar-manager:v0.2.0
 ```
 
+### Enable swagger UI
+To enable swagger UI, set `swagger.enabled=true` in the 
`application.properties` file. The default value is `true`.
+
+If you want to disable swagger UI in the  production environment, you can set 
`swagger.enabled=false`.
+
+### How to use swagger to access the API
+1. Enable swagger UI by setting 'swagger.enabled=true' in the 
`application.properties` file.
+
+2. Visit http://YOUR_BACKEND_SERVICE_HOST:7750/swagger-ui.html
+
+3. Request the login API, use the username and password of the Pulsar Manager 
to login, copy the `token` of the response header.
+   
+The request body is as follows:
+```$xslt
+{
+  "username": "admin",
+  "password": "apachepulsar"
+}
+```
+Copy the token of the response header.
+![swagger-request-login](../docs/img/swagger-request-login.png)
+
+4. Authorize. Click the `Authorize` button in swagger UI, and then fill in the 
authorization information of swagger.
+ - environment: the environment name you have configured in Pulsar Manager.
+ - token: the token you have copied in the previous step.
+ - username: the username you login.
+
+![swagger-authorize](../docs/img/swagger-authorize.png)
+
+5. Request other APIs.
+
  Third party login options
 
 ```
diff --git 
a/src/main/java/org/apache/pulsar/manager/interceptor/WebAppConfigurer.java 
b/src/main/java/org/apache/pulsar/manager/interceptor/WebAppConfigurer.java
index 9637f43..ddfd79f 100644
--- a/src/main/java/org/apache/pulsar/manager/interceptor/WebAppConfigurer.java
+++ b/src/main/java/org/apache/pulsar/manager/interceptor/WebAppConfigurer.java
@@ -29,6 +29,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
 @Resource
 private AdminHandlerInterceptor adminHandlerInterceptor;
 
+
 @Override
 public void addInterceptors(InterceptorRegistry registry) {
 registry.addInterceptor(adminHandlerInterceptor).addPathPatterns("/**")
@@ -40,6 +41,14 @@ public class WebAppConfigurer implements WebMvcConfigurer {
 .excludePathPatterns("/ui")
 .excludePathPatterns("/static")
 .excludePathPatterns("/error")
+// swagger
+.excludePathPatterns("/swagger-ui.html")
+ 

[pulsar-manager] branch master updated: Add frequently asked questions document (#308)

2020-12-23 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2ca8a39  Add frequently asked questions document (#308)
2ca8a39 is described below

commit 2ca8a39efc2ad24ea8b1cb1f317bb84413be2019
Author: Guangning 
AuthorDate: Wed Dec 23 19:42:26 2020 +0800

Add frequently asked questions document (#308)

* There are some problems that users often encounter, so add a faq document
---
 docs/faq.md | 102 
 1 file changed, 102 insertions(+)

diff --git a/docs/faq.md b/docs/faq.md
new file mode 100644
index 000..a73319f
--- /dev/null
+++ b/docs/faq.md
@@ -0,0 +1,102 @@
+## FAQ
+
+* Question: "I cannot do any operation on Pulsar" or "Pulsar Manager does not 
show the `standalone cluster` option when adding to a tenant?
+```
+java.lang.NullPointerException: null
+   at 
org.apache.pulsar.manager.service.impl.BrokersServiceImpl.getBrokersList(BrokersServiceImpl.java:54)
 ~[pulsar-manager.jar:na]
+   at 
org.apache.pulsar.manager.service.impl.ClustersServiceImpl.getClustersList(ClustersServiceImpl.java:70)
 ~[pulsar-manager.jar:na]
+   at 
org.apache.pulsar.manager.service.impl.BrokerStatsServiceImpl.scheduleCollectStats(BrokerStatsServiceImpl.java:129)
 ~[pulsar-manager.jar:na]
+   at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source) 
~[na:na]
+   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:1.8.0_212]
+   at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
+   at 
org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
 ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
+   at 
org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
 ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
+   at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[na:1.8.0_212]
+   at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) 
[na:1.8.0_212]
+   at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
 [na:1.8.0_212]
+   at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
 [na:1.8.0_212]
+   at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[na:1.8.0_212]
+   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[na:1.8.0_212]
+   at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
+```
+
+* Reason: The webservice URL configured by the Pulsar cluster when 
initializing metadata is inconsistent with the actual webservice URL.
+
+* Solution: check the status and information of the cluster.
+```
+./bin/pulsar-admin clusters list
+./bin/pulsar-admin clusters get cluster-name (eg, standalone)
+```
+
+The following results are correct:
+```
+./bin/pulsar-admin clusters get standalone
+{
+  "serviceUrl" : "http://127.0.0.1:8080;,
+  "brokerServiceUrl" : "pulsar://127.0.0.1:6650"
+}
+```
+Your network should be connected to serviceUrl's network.
+
+If these two domain names are set incorrectly, use the `./bin/pulsar-admin 
clusters update` command to update them.
+```
+./bin/pulsar-admin clusters update --broker-url http://broker-ip:6605 --url 
http://broker-ip:8080 cluster-name (eg, standalone)
+```
+* Releated issue: https://github.com/apache/pulsar-manager/issues/292
+
+
+* Question: Pulsar Manager keeps saying "This environment is error. Please 
check it"
+
+* Reason: Your Pulsar Manager service cannot connect with your Pulsar cluster 
network.
+
+
+* Solution:  _pulsar_  and _pulsar-manger_ runs in different containers with 
their own localhosts (each container just knows its own `localhost`).
+You should either run these two containers in one network using tools like 
Docker composer or set `--network host` as below.
+```bash
+docker run --rm --network host -it  -e REDIRECT_HOST=http://localhost -e 
REDIRECT_PORT=9527 -e DRIVER_CLASS_NAME=org.postgresql.Driver -e 
URL='jdbc:postgresql://127.0.0.1:5432/pulsar_manager' -e USERNAME=pulsar -e 
PASSWORD=pulsar -e LOG_LEVEL=DEBUG -v $PWD:/data 
apachepulsar/pulsar-manager:v0.1.0 /bin/sh
+```
+
+* Releated issue: https://github.com/apache/pulsar-manager/issues/292 
https://github.com/apache/pulsar-manager/issues/214
+
+
+## Troubleshooting steps for Pulsar Manager
+
+1. Check whether the Pulsar cluster runs well.
+
+```
+curl -v http://webservice-url:port/metrics/
+
+For example:
+curl -v http://localhost:8080/metrics/
+```
+
+2. Check the cluster configuration.
+
+```
+./bin/pulsar-admin

[pulsar-manager] branch master updated: fix ISSUE-365: Some mistakes in README.md of the master branch (#366)

2020-12-22 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 7286072  fix ISSUE-365: Some mistakes in README.md of the master 
branch (#366)
7286072 is described below

commit 72860726536eec092438ec849e1b6648c6b5b7cc
Author: yixin 
AuthorDate: Wed Dec 23 14:34:12 2020 +0800

fix ISSUE-365: Some mistakes in README.md of the master branch (#366)

Co-authored-by: yixin 

Fixes #366

### Motivation

Some mistakes in README.md of the master branch, and I have fixed them.

### Modifications

I modified the README.md.

### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index fc2be0b..3baf4da 100644
--- a/README.md
+++ b/README.md
@@ -107,10 +107,10 @@ The Pulsar Manager can be deployed as part of [Pulsar 
Helm Chart](https://github
 ### Build from bin package
 
 ```
-wget 
https://dist.apache.org/repos/dist/release/pulsar/pulsar-manager/apache-pulsar-manager-0.2.0/apache-pulsar-manager-0.2.0-bin.tar.gz
+wget 
https://dist.apache.org/repos/dist/release/pulsar/pulsar-manager/pulsar-manager-0.2.0/apache-pulsar-manager-0.2.0-bin.tar.gz
 tar -zxvf apache-pulsar-manager-0.2.0-bin.tar.gz
 cd pulsar-manager
-tar -zxvf pulsar-manager.tar
+tar -xvf pulsar-manager.tar
 cd pulsar-manager
 cp -r ../dist ui
 ./bin/pulsar-manager



[pulsar-manager] branch master updated: Fix spelling of 'ensemble' (#363)

2020-12-22 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 272c9a4  Fix spelling of 'ensemble' (#363)
272c9a4 is described below

commit 272c9a41cb13d7fd11dc221cf17c9948335c5964
Author: Daniel Orf 
AuthorDate: Tue Dec 22 17:44:24 2020 -0800

Fix spelling of 'ensemble' (#363)

### Motivation

Spotted a misspelling when testing out pulsar-manager

### Modifications

Replaced mentions of "ensembel" with "ensemble" in the Namespaces/Policies 
page

### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 front-end/src/lang/en.js  | 4 ++--
 front-end/src/lang/zh.js  | 4 ++--
 .../views/management/namespaceIsolations/namespaceIsolationPolicy.vue | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index a87c5db..3e87161 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -369,8 +369,8 @@ export default {
   ensembleSizeDescription: ': number of bookies to use when creating a 
ledger.',
   writeQuorumSizeDescription: ': number of replicas to store for each 
message.',
   ackQuorumSizeDescription: ': number of responses to wait before claiming 
a message is guaranteed to be stored.',
-  ensembleSize: 'Ensembel Size',
-  inputEnsemble: 'Please input ensembel',
+  ensembleSize: 'Ensemble Size',
+  inputEnsemble: 'Please input ensemble',
   writeQuorumSize: 'Write Quorum Size',
   inputWriteQuorumSize: 'Please input Write Quorum Size',
   readQuorumSize: 'Ack Quorum Size',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index 574d7fd..304ddd0 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -369,8 +369,8 @@ export default {
   ensembleSizeDescription: ': number of bookies to use when creating a 
ledger.',
   writeQuorumSizeDescription: ': number of replicas to store for each 
message.',
   ackQuorumSizeDescription: ': number of responses to wait before claiming 
a message is guaranteed to be stored.',
-  ensembleSize: 'Ensembel Size',
-  inputEnsemble: 'Please input ensembel',
+  ensembleSize: 'Ensemble Size',
+  inputEnsemble: 'Please input ensemble',
   writeQuorumSize: 'Write Quorum Size',
   inputWriteQuorumSize: 'Please input Write Quorum Size',
   readQuorumSize: 'Ack Quorum Size',
diff --git 
a/front-end/src/views/management/namespaceIsolations/namespaceIsolationPolicy.vue
 
b/front-end/src/views/management/namespaceIsolations/namespaceIsolationPolicy.vue
index 81d7811..3ab1237 100644
--- 
a/front-end/src/views/management/namespaceIsolations/namespaceIsolationPolicy.vue
+++ 
b/front-end/src/views/management/namespaceIsolations/namespaceIsolationPolicy.vue
@@ -141,7 +141,7 @@
   :value="item.value"/>
   
   
-
+
   {{ $t('ip.brokerUsageThresholdLabel') }} (%)
   
 



[pulsar-manager] branch master updated (599fd20 -> b4b2549)

2020-12-22 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 599fd20  Issue 359: Upgrade BKVM to 3.0.0 (#360)
 add b4b2549  create /data dir (#364)

No new revisions were added by this update.

Summary of changes:
 docker/entrypoint.sh | 1 +
 1 file changed, 1 insertion(+)



[pulsar-manager] branch master updated: Issue 359: Upgrade BKVM to 3.0.0 (#360)

2020-12-14 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 599fd20  Issue 359: Upgrade BKVM to 3.0.0 (#360)
599fd20 is described below

commit 599fd207357db36f9dd25ac89e905ba1a258ccd1
Author: Diana Clementi 
AuthorDate: Tue Dec 15 07:16:14 2020 +0100

Issue 359: Upgrade BKVM to 3.0.0 (#360)

* Issue 359: Upgrade BKVM to 3.0.0

* Issue 359: Upgrade BKVM to 3.0.0 - fix pulsar broker version
---
 build.gradle  |  2 +-
 gradle.properties |  7 +++
 .../pulsar/manager/service/TopicsServiceImplTest.java | 15 +--
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/build.gradle b/build.gradle
index 786039c..af17e01 100644
--- a/build.gradle
+++ b/build.gradle
@@ -127,7 +127,7 @@ dependencies {
 compile group: 'org.apache.pulsar', name: 'pulsar-client-auth-sasl', 
version: pulsarVersion
 compile group: 'io.springfox', name: 'springfox-swagger2', version: 
swagger2Version
 compile group: 'io.springfox', name: 'springfox-swagger-ui', version: 
swaggeruiVersion
-compile group: 'org.apache.pulsar', name: 'pulsar-broker', version: 
brokerVersion
+compile group: 'org.apache.pulsar', name: 'pulsar-broker', version: 
pulsarVersion
 compile group: 'commons-validator', name: 'commons-validator', version: 
commonsValidatorVersion
 compile (group: 'org.bkvm', name: 'bkvm', version: bkvmVersion, ext: 
'war', classifier:'war-no-libs') {
 exclude group: 'org.slf4j', module: 'slf4j-jdk14'
diff --git a/gradle.properties b/gradle.properties
index 7ac55c5..c66f4d7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -10,16 +10,15 @@ lombokVersion=1.18.10
 pageHelperVersion=1.2.4
 mockitoVersion=2.8.47
 guavaVersion=21.0
-pulsarVersion=2.5.2
+pulsarVersion=2.7.0
 swagger2Version=2.9.2
 swaggeruiVersion=2.9.2
 apiMockitoVersion=1.7.1
 mockitoJunit4Version=1.7.1
 gsonVersion=2.8.2
 postgresqlVersion=42.2.5
-herddbVersion=0.19.0
-brokerVersion=2.4.1
+herddbVersion=0.22.0
 commonsValidatorVersion=1.6
-bkvmVersion=2.0.0
+bkvmVersion=3.0.0
 tomcatVersion=8.5.31
 jerseyVersion=2.26
diff --git 
a/src/test/java/org/apache/pulsar/manager/service/TopicsServiceImplTest.java 
b/src/test/java/org/apache/pulsar/manager/service/TopicsServiceImplTest.java
index e998d07..bdeef37 100644
--- a/src/test/java/org/apache/pulsar/manager/service/TopicsServiceImplTest.java
+++ b/src/test/java/org/apache/pulsar/manager/service/TopicsServiceImplTest.java
@@ -39,13 +39,14 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import org.apache.pulsar.common.api.proto.PulsarApi;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(
-classes = {
-PulsarManagerApplication.class,
-HerdDBTestProfile.class
-}
+classes = {
+PulsarManagerApplication.class,
+HerdDBTestProfile.class
+}
 )
 @ActiveProfiles("test")
 public class TopicsServiceImplTest {
@@ -117,7 +118,7 @@ public class TopicsServiceImplTest {
 topicMap.put("partitions", "0");
 topics.add(topicMap);
 
-List> topicsList =  
topicsService.getTopicsStatsList(
+List> topicsList = 
topicsService.getTopicsStatsList(
 environment, tenant, namespace, policy, topics);
 topicsList.forEach((t) -> {
 Assert.assertEquals(0, t.get("partitions"));
@@ -133,7 +134,8 @@ public class TopicsServiceImplTest {
 public void peekMessagesTest() throws PulsarAdminException {
 
Mockito.when(pulsarAdminService.topics("http://localhost:8080;)).thenReturn(topics);
 List> messages = new ArrayList<>();
-messages.add(new 
MessageImpl("persistent://public/default/test", "1:1", 
Maps.newTreeMap(), "test".getBytes(), Schema.BYTES));
+messages.add(new MessageImpl<>("persistent://public/default/test", 
"1:1", Maps.newTreeMap(), "test".getBytes(),
+Schema.BYTES, PulsarApi.MessageMetadata.newBuilder()));
 Mockito.when(topics.peekMessages("persistent://public/default/test", 
"sub-1", 1)).thenReturn(messages);
 
 List> result = topicsService.peekMessages(
@@ -149,4 +151,5 @@ public class TopicsServiceImplTest {
 Assert.assertEquals(new String("test".getBytes()), new 
String((byte[]) message.get("data")));
 });
 }
+
 }



[pulsar] branch master updated (0544421 -> a95369d)

2020-12-10 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


from 0544421  [CI] Always build latest images for integration tests (#8885)
 add a95369d  [SpotBugs][pulsar-io]Enable spotbugs for 
batch-discovery-triggerers and batch-data-generator (#8889)

No new revisions were added by this update.

Summary of changes:
 pulsar-io/batch-data-generator/pom.xml | 21 +
 .../BatchDataGeneratorPushSource.java  |  6 +++--
 .../BatchDataGeneratorSource.java  |  5 +++--
 .../src/main/resources/findbugsExclude.xml |  0
 pulsar-io/batch-discovery-triggerers/pom.xml   | 26 ++
 .../src/main/resources/findbugsExclude.xml |  0
 6 files changed, 54 insertions(+), 4 deletions(-)
 copy {pulsar-package-management/core => 
pulsar-io/batch-data-generator}/src/main/resources/findbugsExclude.xml (100%)
 copy {pulsar-package-management/core => 
pulsar-io/batch-discovery-triggerers}/src/main/resources/findbugsExclude.xml 
(100%)



[pulsar-manager] branch master updated: Passing LoggerFactory to @Slf4j lombok notation (#356)

2020-12-04 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new d15a0f1  Passing LoggerFactory to @Slf4j lombok notation (#356)
d15a0f1 is described below

commit d15a0f1e45a3fe9821df51361584dce87e104948
Author: Matteo Minardi 
AuthorDate: Sat Dec 5 02:49:35 2020 +0100

Passing LoggerFactory to @Slf4j lombok notation (#356)

### Motivation

Remove boilerplate code for the logger setup.

### Modifications

Passed the remaining explicit declarations of LoggerFactory to @Slf4j 
annotation
---
 .../org/apache/pulsar/manager/PulsarApplicationListener.java | 6 ++
 .../apache/pulsar/manager/controller/EnvironmentsController.java | 6 ++
 .../org/apache/pulsar/manager/interceptor/WebAppConfigurer.java  | 7 +++
 .../pulsar/manager/service/impl/BrokerStatsServiceImpl.java  | 6 ++
 .../apache/pulsar/manager/service/impl/BrokersServiceImpl.java   | 6 ++
 .../apache/pulsar/manager/service/impl/ClustersServiceImpl.java  | 6 ++
 .../pulsar/manager/service/impl/NamespacesServiceImpl.java   | 6 ++
 .../pulsar/manager/service/impl/PulsarAdminServiceImpl.java  | 6 ++
 .../apache/pulsar/manager/service/impl/TenantsServiceImpl.java   | 6 ++
 .../apache/pulsar/manager/service/impl/TopicsServiceImpl.java| 6 ++
 src/main/java/org/apache/pulsar/manager/utils/HttpUtil.java  | 6 ++
 .../java/org/apache/pulsar/manager/zuul/EnvironmentForward.java  | 6 ++
 .../org/apache/pulsar/manager/profiles/HerdDBTestProfile.java| 9 -
 .../org/apache/pulsar/manager/profiles/SqliteDBTestProfile.java  | 9 -
 14 files changed, 33 insertions(+), 58 deletions(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/PulsarApplicationListener.java 
b/src/main/java/org/apache/pulsar/manager/PulsarApplicationListener.java
index 4cc1c40..82ee60e 100644
--- a/src/main/java/org/apache/pulsar/manager/PulsarApplicationListener.java
+++ b/src/main/java/org/apache/pulsar/manager/PulsarApplicationListener.java
@@ -14,12 +14,11 @@
 package org.apache.pulsar.manager;
 
 import com.github.pagehelper.Page;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.pulsar.client.admin.PulsarAdminException;
 import org.apache.pulsar.manager.entity.EnvironmentEntity;
 import org.apache.pulsar.manager.entity.EnvironmentsRepository;
 import org.apache.pulsar.manager.service.PulsarAdminService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationListener;
@@ -32,10 +31,9 @@ import java.util.Optional;
  * PulsarApplicationListener do something after the spring framework 
initialization is complete.
  */
 @Component
+@Slf4j
 public class PulsarApplicationListener implements 
ApplicationListener {
 
-private static final Logger log = 
LoggerFactory.getLogger(PulsarApplicationListener.class);
-
 private final EnvironmentsRepository environmentsRepository;
 
 private final PulsarAdminService pulsarAdminService;
diff --git 
a/src/main/java/org/apache/pulsar/manager/controller/EnvironmentsController.java
 
b/src/main/java/org/apache/pulsar/manager/controller/EnvironmentsController.java
index 0b050a0..f49e915 100644
--- 
a/src/main/java/org/apache/pulsar/manager/controller/EnvironmentsController.java
+++ 
b/src/main/java/org/apache/pulsar/manager/controller/EnvironmentsController.java
@@ -15,6 +15,7 @@ package org.apache.pulsar.manager.controller;
 
 import com.google.common.collect.Maps;
 
+import lombok.extern.slf4j.Slf4j;
 import org.apache.pulsar.client.admin.PulsarAdminException;
 import org.apache.pulsar.manager.entity.EnvironmentEntity;
 import org.apache.pulsar.manager.entity.EnvironmentsRepository;
@@ -36,8 +37,6 @@ import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import org.apache.pulsar.manager.utils.ResourceType;
 import org.hibernate.validator.constraints.Range;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.validation.annotation.Validated;
@@ -61,10 +60,9 @@ import java.util.Optional;
 @Api(description = "Support change environments")
 @Validated
 @RestController
+@Slf4j
 public class EnvironmentsController {
 
-private static final Logger log = 
LoggerFactory.getLogger(EnvironmentsController.class);
-
 private final EnvironmentsRepository environmentsRepository;
 
 private final EnvironmentCacheService environmentCacheService;
diff --git 
a/src/main/java/org/apache/pulsar/manager/interceptor/WebAppConfigurer.java 
b/src/main/java/org/apache/puls

[pulsar-manager] branch master updated: Add auto refresh in Topic Details page #341 (#352)

2020-11-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 6f67028  Add auto refresh in Topic Details page #341 (#352)
6f67028 is described below

commit 6f67028548142059225f4929efd955a3cd888f49
Author: xuesongxs <54351417+xueson...@users.noreply.github.com>
AuthorDate: Thu Nov 12 09:53:29 2020 +0800

Add auto refresh in Topic Details page #341 (#352)

Fixes #341

### Motivation

Add auto refresh in Topic Details page
---
 front-end/src/lang/en.js   |  3 +-
 front-end/src/lang/zh.js   |  3 +-
 .../views/management/topics/partitionedTopic.vue   | 40 ++
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index 5f5fd59..a87c5db 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -637,7 +637,8 @@ export default {
 deleteTopicMessage: 'Are you sure you want to delete this topic?',
 partitionedTopicName: 'Partitioned Topic Name',
 selectRoleMessage: 'Please Select Role',
-backlogOpeartion: 'Backlog Operation'
+backlogOpeartion: 'Backlog Operation',
+autoRefresh: 'Auto Refresh'
   },
   cluster: {
 label: 'Cluster',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index 59afe53..574d7fd 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -635,7 +635,8 @@ export default {
 deleteTopicMessage: 'Are you sure you want to delete this topic?',
 partitionedTopicName: 'Partitioned Topic Name',
 selectRoleMessage: 'Please Select Role',
-backlogOpeartion: 'Backlog Operation'
+backlogOpeartion: 'Backlog Operation',
+autoRefresh: 'Auto Refresh'
   },
   cluster: {
 label: 'Cluster',
diff --git a/front-end/src/views/management/topics/partitionedTopic.vue 
b/front-end/src/views/management/topics/partitionedTopic.vue
index b0857a3..8277231 100644
--- a/front-end/src/views/management/topics/partitionedTopic.vue
+++ b/front-end/src/views/management/topics/partitionedTopic.vue
@@ -32,6 +32,17 @@
 
   
 
+
+  
+
+  
+  
+  
+  
+  
+
+  
+
   
   
 
@@ -331,6 +342,7 @@ export default {
   },
   data() {
 return {
+  autoRefreshInterval: 'off',
   postForm: Object.assign({}, defaultForm),
   clusterForm: Object.assign({}, defaultClusterForm),
   activeName: 'overview',
@@ -410,6 +422,17 @@ export default {
 this.getReplicatedClusters()
 this.initTopicStats()
 this.initPermissions()
+let refreshInterval = sessionStorage.getItem('refreshInterval')
+this.autoRefreshInterval = refreshInterval
+setTimeout(() => {
+  if (refreshInterval !== null && refreshInterval !== undefined && 
refreshInterval !== 'off') {
+refreshInterval = parseInt(refreshInterval)
+this.refreshIntervalId = setInterval(() => {
+  location.reload()
+  this.$refs.autoRefreshSelect.value = refreshInterval
+}, refreshInterval * 1000)
+  }
+}, 1000)
   },
   methods: {
 getRemoteTenantsList() {
@@ -762,6 +785,19 @@ export default {
 this.initTopicStats()
 this.dialogFormVisible = false
   })
+},
+onAutoRefreshChanged(val) {
+  if (this.refreshIntervalId !== undefined) {
+clearInterval(this.refreshIntervalId)
+  }
+  if (val !== 'off') {
+sessionStorage.setItem('refreshInterval', val)
+this.refreshIntervalId = setInterval(() => {
+  location.reload()
+}, val * 1000)
+  } else {
+sessionStorage.removeItem('refreshInterval')
+  }
 }
   }
 }
@@ -791,4 +827,8 @@ export default {
   -webkit-transform: rotate(90deg); /* Safari 和 Chrome */
   -o-transform: rotate(90deg); /* Opera */
 }
+
+.refresh-container {
+  float:right;
+}
 



[pulsar-manager] branch master updated: When user management is disabled login fails (#351)

2020-11-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 609510f  When user management is disabled login fails (#351)
609510f is described below

commit 609510f0d95fd426577e1521073628e9db6e6b81
Author: Stepan 
AuthorDate: Thu Nov 12 04:54:16 2020 +0300

When user management is disabled login fails (#351)

**Fixes #347**

### Motivation

Bug. If user management is turned off then user has no way to log in as 
default credentials don't pass login validation.

### Modifications

When check for super user is being performed and user management is 
disabled then use token generated for default credentials which are defined in 
properties file.
---
 .../manager/service/impl/RolesServiceImpl.java | 19 +++
 .../manager/service/RolesServiceImplTest.java  | 38 +-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java 
b/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
index cd6f61f..7c99587 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
@@ -31,13 +31,18 @@ import org.apache.pulsar.manager.entity.TenantsRepository;
 import org.apache.pulsar.manager.entity.UserInfoEntity;
 import org.apache.pulsar.manager.entity.UsersRepository;
 import org.apache.pulsar.manager.service.ClustersService;
+import org.apache.pulsar.manager.service.JwtService;
 import org.apache.pulsar.manager.service.RolesService;
 import org.apache.pulsar.manager.service.TenantsService;
 import org.apache.pulsar.manager.utils.ResourceType;
 import org.apache.pulsar.manager.utils.ResourceVerbs;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -47,6 +52,8 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Pattern;
 
+import static java.util.Objects.requireNonNull;
+
 @Slf4j
 @Service
 public class RolesServiceImpl implements RolesService {
@@ -75,6 +82,12 @@ public class RolesServiceImpl implements RolesService {
 @Autowired
 private NamespacesRepository namespacesRepository;
 
+@Autowired
+private JwtService jwtService;
+
+@Value("${user.management.enable}")
+private boolean userManagementEnabled;
+
 private final String VERBS_SEPARATOR = ",";
 
 private static final Pattern pattern = Pattern.compile("[A-Za-z0-9_]+");
@@ -247,7 +260,13 @@ public class RolesServiceImpl implements RolesService {
 result.put("message", "Validate tenant success");
 return result;
 }
+
 public boolean isSuperUser(String token) {
+if (!userManagementEnabled) {
+HttpServletRequest request = 
requireNonNull((ServletRequestAttributes) 
RequestContextHolder.getRequestAttributes()).getRequest();
+String serverToken = 
jwtService.getToken(request.getSession().getId());
+return StringUtils.equalsIgnoreCase(serverToken, token);
+}
 Optional userInfoEntityOptional = 
usersRepository.findByAccessToken(token);
 if (!userInfoEntityOptional.isPresent()) {
 return false;
diff --git 
a/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java 
b/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
index 604ec3d..071fb37 100644
--- a/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
+++ b/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
@@ -31,17 +31,27 @@ import org.apache.pulsar.manager.utils.ResourceVerbs;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 import org.powermock.modules.junit4.PowerMockRunnerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test

[pulsar-manager] branch master updated: Add auto refresh in Topic Details page #341 (#352)

2020-11-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 6f67028  Add auto refresh in Topic Details page #341 (#352)
6f67028 is described below

commit 6f67028548142059225f4929efd955a3cd888f49
Author: xuesongxs <54351417+xueson...@users.noreply.github.com>
AuthorDate: Thu Nov 12 09:53:29 2020 +0800

Add auto refresh in Topic Details page #341 (#352)

Fixes #341

### Motivation

Add auto refresh in Topic Details page
---
 front-end/src/lang/en.js   |  3 +-
 front-end/src/lang/zh.js   |  3 +-
 .../views/management/topics/partitionedTopic.vue   | 40 ++
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/front-end/src/lang/en.js b/front-end/src/lang/en.js
index 5f5fd59..a87c5db 100644
--- a/front-end/src/lang/en.js
+++ b/front-end/src/lang/en.js
@@ -637,7 +637,8 @@ export default {
 deleteTopicMessage: 'Are you sure you want to delete this topic?',
 partitionedTopicName: 'Partitioned Topic Name',
 selectRoleMessage: 'Please Select Role',
-backlogOpeartion: 'Backlog Operation'
+backlogOpeartion: 'Backlog Operation',
+autoRefresh: 'Auto Refresh'
   },
   cluster: {
 label: 'Cluster',
diff --git a/front-end/src/lang/zh.js b/front-end/src/lang/zh.js
index 59afe53..574d7fd 100644
--- a/front-end/src/lang/zh.js
+++ b/front-end/src/lang/zh.js
@@ -635,7 +635,8 @@ export default {
 deleteTopicMessage: 'Are you sure you want to delete this topic?',
 partitionedTopicName: 'Partitioned Topic Name',
 selectRoleMessage: 'Please Select Role',
-backlogOpeartion: 'Backlog Operation'
+backlogOpeartion: 'Backlog Operation',
+autoRefresh: 'Auto Refresh'
   },
   cluster: {
 label: 'Cluster',
diff --git a/front-end/src/views/management/topics/partitionedTopic.vue 
b/front-end/src/views/management/topics/partitionedTopic.vue
index b0857a3..8277231 100644
--- a/front-end/src/views/management/topics/partitionedTopic.vue
+++ b/front-end/src/views/management/topics/partitionedTopic.vue
@@ -32,6 +32,17 @@
 
   
 
+
+  
+
+  
+  
+  
+  
+  
+
+  
+
   
   
 
@@ -331,6 +342,7 @@ export default {
   },
   data() {
 return {
+  autoRefreshInterval: 'off',
   postForm: Object.assign({}, defaultForm),
   clusterForm: Object.assign({}, defaultClusterForm),
   activeName: 'overview',
@@ -410,6 +422,17 @@ export default {
 this.getReplicatedClusters()
 this.initTopicStats()
 this.initPermissions()
+let refreshInterval = sessionStorage.getItem('refreshInterval')
+this.autoRefreshInterval = refreshInterval
+setTimeout(() => {
+  if (refreshInterval !== null && refreshInterval !== undefined && 
refreshInterval !== 'off') {
+refreshInterval = parseInt(refreshInterval)
+this.refreshIntervalId = setInterval(() => {
+  location.reload()
+  this.$refs.autoRefreshSelect.value = refreshInterval
+}, refreshInterval * 1000)
+  }
+}, 1000)
   },
   methods: {
 getRemoteTenantsList() {
@@ -762,6 +785,19 @@ export default {
 this.initTopicStats()
 this.dialogFormVisible = false
   })
+},
+onAutoRefreshChanged(val) {
+  if (this.refreshIntervalId !== undefined) {
+clearInterval(this.refreshIntervalId)
+  }
+  if (val !== 'off') {
+sessionStorage.setItem('refreshInterval', val)
+this.refreshIntervalId = setInterval(() => {
+  location.reload()
+}, val * 1000)
+  } else {
+sessionStorage.removeItem('refreshInterval')
+  }
 }
   }
 }
@@ -791,4 +827,8 @@ export default {
   -webkit-transform: rotate(90deg); /* Safari 和 Chrome */
   -o-transform: rotate(90deg); /* Opera */
 }
+
+.refresh-container {
+  float:right;
+}
 



[pulsar-manager] branch master updated: When user management is disabled login fails (#351)

2020-11-11 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 609510f  When user management is disabled login fails (#351)
609510f is described below

commit 609510f0d95fd426577e1521073628e9db6e6b81
Author: Stepan 
AuthorDate: Thu Nov 12 04:54:16 2020 +0300

When user management is disabled login fails (#351)

**Fixes #347**

### Motivation

Bug. If user management is turned off then user has no way to log in as 
default credentials don't pass login validation.

### Modifications

When check for super user is being performed and user management is 
disabled then use token generated for default credentials which are defined in 
properties file.
---
 .../manager/service/impl/RolesServiceImpl.java | 19 +++
 .../manager/service/RolesServiceImplTest.java  | 38 +-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java 
b/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
index cd6f61f..7c99587 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/RolesServiceImpl.java
@@ -31,13 +31,18 @@ import org.apache.pulsar.manager.entity.TenantsRepository;
 import org.apache.pulsar.manager.entity.UserInfoEntity;
 import org.apache.pulsar.manager.entity.UsersRepository;
 import org.apache.pulsar.manager.service.ClustersService;
+import org.apache.pulsar.manager.service.JwtService;
 import org.apache.pulsar.manager.service.RolesService;
 import org.apache.pulsar.manager.service.TenantsService;
 import org.apache.pulsar.manager.utils.ResourceType;
 import org.apache.pulsar.manager.utils.ResourceVerbs;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -47,6 +52,8 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Pattern;
 
+import static java.util.Objects.requireNonNull;
+
 @Slf4j
 @Service
 public class RolesServiceImpl implements RolesService {
@@ -75,6 +82,12 @@ public class RolesServiceImpl implements RolesService {
 @Autowired
 private NamespacesRepository namespacesRepository;
 
+@Autowired
+private JwtService jwtService;
+
+@Value("${user.management.enable}")
+private boolean userManagementEnabled;
+
 private final String VERBS_SEPARATOR = ",";
 
 private static final Pattern pattern = Pattern.compile("[A-Za-z0-9_]+");
@@ -247,7 +260,13 @@ public class RolesServiceImpl implements RolesService {
 result.put("message", "Validate tenant success");
 return result;
 }
+
 public boolean isSuperUser(String token) {
+if (!userManagementEnabled) {
+HttpServletRequest request = 
requireNonNull((ServletRequestAttributes) 
RequestContextHolder.getRequestAttributes()).getRequest();
+String serverToken = 
jwtService.getToken(request.getSession().getId());
+return StringUtils.equalsIgnoreCase(serverToken, token);
+}
 Optional userInfoEntityOptional = 
usersRepository.findByAccessToken(token);
 if (!userInfoEntityOptional.isPresent()) {
 return false;
diff --git 
a/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java 
b/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
index 604ec3d..071fb37 100644
--- a/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
+++ b/src/test/java/org/apache/pulsar/manager/service/RolesServiceImplTest.java
@@ -31,17 +31,27 @@ import org.apache.pulsar.manager.utils.ResourceVerbs;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mockito;
 import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 import org.powermock.modules.junit4.PowerMockRunnerDelegate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test

[pulsar-manager] branch master updated: Fix README (#350)

2020-11-05 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 83a21d7  Fix README (#350)
83a21d7 is described below

commit 83a21d7d386600f777ee9ae44b97555699a9f63f
Author: Soroush <53372749+t...@users.noreply.github.com>
AuthorDate: Fri Nov 6 04:32:51 2020 +0330

Fix README (#350)

### Motivation

In README, the bash example for creating a super-user is incorrect: It 
encloses the `$CSRF_TOKEN` variable in single quotes, which do not interpolate 
variables. Double quotes must be used instead. Also, this code block has an 
incorrect language of `$xslt`.

Additionally, in several cases in README, missing/incorrect indentation has 
caused code block delimiters (triple backquotes) to literally appear in the 
displayed code.

### Modifications

Fixed the issues mentioned above.

Also, added a bullet point before `backend-service` to be consistent with 
an earlier example (`SPRING_CONFIGURATION_FILE`).

### Verifying this change

- [x] Make sure that the change passes the `./gradlew build` checks.
---
 README.md | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index 52cef07..fc2be0b 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ is able to talk to the brokers and bookies in your Pulsar 
cluster.
 
 2. Start Pulsar Manager in a separate container.
 
-> NOTE: the command links the pulsar-manager container with the pulsar 
standalone container so they are in the same network.
+> NOTE: the command links the pulsar-manager container with the pulsar 
standalone container so they are in the same network.
 
 ```
 docker pull apachepulsar/pulsar-manager:v0.2.0
@@ -47,7 +47,7 @@ is able to talk to the brokers and bookies in your Pulsar 
cluster.
 apachepulsar/pulsar-manager:v0.2.0
 ```
 
-> NOTE: Enable bookkeeper visual manager(Optional), update the field 
`bkvm.enabled` to `true` for the file 
[bkvm.conf](https://github.com/apache/pulsar-manager/blob/master/src/main/resources/bkvm.conf).
+> NOTE: Enable bookkeeper visual manager(Optional), update the field 
`bkvm.enabled` to `true` for the file 
[bkvm.conf](https://github.com/apache/pulsar-manager/blob/master/src/main/resources/bkvm.conf).
 
 ```
 docker pull apachepulsar/pulsar-manager:v0.2.0
@@ -59,7 +59,7 @@ is able to talk to the brokers and bookies in your Pulsar 
cluster.
 apachepulsar/pulsar-manager:v0.2.0
 ```
 
-* `SPRING_CONFIGURATION_FILE`: Default configuration file for spring.
+* `SPRING_CONFIGURATION_FILE`: Default configuration file for spring.
 
 ### Use Docker Compose
 
@@ -167,26 +167,27 @@ After running these steps, the Pulsar Manager is running 
locally at http://127.0
 
 1. Access Pulsar manager UI at `http://${frontend-end-ip}/#/environments`.
 
-If you started Pulsar Manager using docker or docker-compose, the Pulsar 
Manager is running at port 9527. You can access the Pulsar Manager UI at 
http://127.0.0.1/#/environments.
+If you started Pulsar Manager using docker or docker-compose, the Pulsar 
Manager is running at port 9527. You can access the Pulsar Manager UI at 
http://127.0.0.1/#/environments.
 
-If you are deploying Pulsar Manager 0.1.0 using the released container, you 
can log in the Pulsar Manager UI using the following credentials.
+If you are deploying Pulsar Manager 0.1.0 using the released container, 
you can log in the Pulsar Manager UI using the following credentials.
 
-   * Account: `pulsar`  
-   * Password: `pulsar`  
-   
-If you are deploying Pulsar Manager using the latest code, you can create a 
super-user using the following command. Then you can use the super user 
credentials to log in the Pulsar Manager UI.
+* Account: `pulsar`  
+* Password: `pulsar`  
 
-```$xslt
+If you are deploying Pulsar Manager using the latest code, you can create 
a super-user using the following command. Then you can use the super user 
credentials to log in the Pulsar Manager UI.
+
+```
 CSRF_TOKEN=$(curl http://backend-service:7750/pulsar-manager/csrf-token)
 curl \
--H 'X-XSRF-TOKEN: $CSRF_TOKEN' \
--H 'Cookie: XSRF-TOKEN=$CSRF_TOKEN;' \
--H "Content-Type: application/json" \
+-H "X-XSRF-TOKEN: $CSRF_TOKEN" \
+-H "Cookie: XSRF-TOKEN=$CSRF_TOKEN;" \
+-H 'Content-Type: application/json' \
 -X PUT http://backend-service:7750/pulsar-manager/users/superuser \
 -d '{"name": "admin", "password": "apachepulsar", "description": 
"test", "email": "usern...@test.org"}'
 ```
-   `backend-service`: The IP address or domain 

[pulsar] branch master updated: Fixed latest doc version sidebar (#8200)

2020-10-04 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning 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 5528113  Fixed latest doc version sidebar (#8200)
5528113 is described below

commit 55281133cee6df3e58439e14304caba46fa05283
Author: Guangning 
AuthorDate: Mon Oct 5 11:02:53 2020 +0800

Fixed latest doc version sidebar (#8200)


Fixes #8016

*(or if this PR is one task of a github issue, please add `Master Issue: 
#` to link to the master issue.)*

Master Issue: #8016

### Motivation


* Fixed latest version doc sidebar

### Modifications

* Fixed latest version doc sidebar

### Verifying this change

local test pass
---
 site2/website/versioned_sidebars/version-2.6.1-sidebars.json | 2 +-
 site2/website/versioned_sidebars/version-2.6.2-sidebars.json | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/site2/website/versioned_sidebars/version-2.6.1-sidebars.json 
b/site2/website/versioned_sidebars/version-2.6.1-sidebars.json
index 57f5651..ab3b408 100644
--- a/site2/website/versioned_sidebars/version-2.6.1-sidebars.json
+++ b/site2/website/versioned_sidebars/version-2.6.1-sidebars.json
@@ -1,5 +1,5 @@
 {
-  "docs": {
+  "version-2.6.1-docs": {
 "Get started": [
   "version-2.6.1-pulsar-2.0",
   "version-2.6.1-standalone",
diff --git a/site2/website/versioned_sidebars/version-2.6.2-sidebars.json 
b/site2/website/versioned_sidebars/version-2.6.2-sidebars.json
index 0d008f3..9aa16d0 100644
--- a/site2/website/versioned_sidebars/version-2.6.2-sidebars.json
+++ b/site2/website/versioned_sidebars/version-2.6.2-sidebars.json
@@ -1,5 +1,5 @@
 {
-  "docs": {
+  "version-2.6.2-docs": {
 "Get started": [
   "version-2.6.2-pulsar-2.0",
   "version-2.6.2-standalone",



[pulsar-manager] branch master updated: add dashboard service for aggregated information collection (#326)

2020-09-30 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 0bd2f8a  add dashboard service for aggregated information collection 
(#326)
0bd2f8a is described below

commit 0bd2f8a04b09c536f7001fecae0d0e926a46f8bd
Author: Jiechuan Chen <654815...@qq.com>
AuthorDate: Thu Oct 1 09:13:03 2020 +0800

add dashboard service for aggregated information collection (#326)

Fixes #282

### Motivation

This is the way I understand how it would be: The access controll is done 
by environmentController when users retrive the environment list from 
'environment' front end page, where the aggregated data is displayed on. And we 
can then retrieve the total number of tenant and corresponding namespace from 
certain environments, as well as a list of topicStat, from which we can further 
retrieve the number of cluster, broker, producer and consumer.

1. environment -> tenant
   2. tenant -> namespace
3. environment -> topicStat
  4. topicStat -> cluster
  5. topicStat -> broker
  6. topicStat -> producer
  7. topicStatId -> consumer

For the number of bookies, currently it is not persistent in database, so 
the bookieservice is called to retrieve the data.

*Explain here the context, and why you're making that change. What is the 
problem you're trying to solve.*

### Modifications

As #282 suggested, added some new sql statements in corresponding mapper 
and a new service to collect aggregated data for dashboard.

### Verifying this change

- [ yes ] Make sure that the change passes the `./gradlew build` checks.
---
 .../manager/controller/DashboardController.java|  57 
 .../manager/dao/ConsumersStatsRepositoryImpl.java  |   7 +
 .../manager/dao/NamespacesRepositoryImpl.java  |   6 +
 .../pulsar/manager/dao/TenantsRepositoryImpl.java  |   6 +
 .../manager/dao/TopicsStatsRepositoryImpl.java |   5 +
 .../manager/entity/ConsumersStatsRepository.java   |   5 +
 .../manager/entity/NamespacesRepository.java   |   2 +
 .../pulsar/manager/entity/TenantsRepository.java   |   2 +
 .../manager/entity/TopicsStatsRepository.java  |   3 +
 .../pulsar/manager/mapper/ConsumerStatsMapper.java |  14 ++
 .../pulsar/manager/mapper/NamespacesMapper.java|   6 +
 .../pulsar/manager/mapper/TenantsMapper.java   |   8 ++
 .../pulsar/manager/mapper/TopicsStatsMapper.java   |  15 +-
 .../pulsar/manager/service/DashboardService.java   |  21 +++
 .../manager/service/impl/DashboardServiceImpl.java | 105 ++
 .../manager/service/DashboardServiceImplTest.java  | 151 +
 16 files changed, 412 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/pulsar/manager/controller/DashboardController.java 
b/src/main/java/org/apache/pulsar/manager/controller/DashboardController.java
new file mode 100644
index 000..33617c2
--- /dev/null
+++ 
b/src/main/java/org/apache/pulsar/manager/controller/DashboardController.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pulsar.manager.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.apache.pulsar.manager.service.DashboardService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Dashboard rest api
+ */
+@RestController
+@RequestMapping(value = "/pulsar-manager")
+@Api(description = "Support dashboard query.")
+@Validated
+public class DashboardController {
+
+private final DashboardService dashboardService;
+
+@Autowired
+public DashboardController(
+DashboardService dashboardService) {
+this.dashboardService = dashboardService;
+}
+
+@ApiOperation(value = "Get the dashboard st

[pulsar-manager] branch master updated (5606ed2 -> df3ece4)

2020-09-30 Thread guangning
This is an automated email from the ASF dual-hosted git repository.

guangning pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git.


from 5606ed2  Update readme file (#337)
 add df3ece4  fix bug: https://github.com/apache/pulsar-manager/issues/340 
(#342)

No new revisions were added by this update.

Summary of changes:
 front-end/src/views/management/namespaces/namespace.vue | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)



  1   2   3   4   >