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

mmerli 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 7c5846d  Add -c/--max-connections parameter to pulsar-perf-go and set 
it to 1 by default (#765)
7c5846d is described below

commit 7c5846d4b883b5b1a546c9634dbf3feca95e8cef
Author: Lari Hotari <[email protected]>
AuthorDate: Fri Apr 29 16:32:38 2022 +0300

    Add -c/--max-connections parameter to pulsar-perf-go and set it to 1 by 
default (#765)
    
    * Add -c/--max-connections parameter to pulsar-perf-go and set it to 1 by 
default
    
    - The Java based pulsar-perf uses 1 connections by default
    
    * Address review comment: make the default for max connections 1
---
 perf/pulsar-perf-go.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/perf/pulsar-perf-go.go b/perf/pulsar-perf-go.go
index 488a74f..aff0b73 100644
--- a/perf/pulsar-perf-go.go
+++ b/perf/pulsar-perf-go.go
@@ -41,16 +41,18 @@ var flagDebug bool
 var PrometheusPort int
 
 type ClientArgs struct {
-       ServiceURL       string
-       TokenFile        string
-       TLSTrustCertFile string
+       ServiceURL              string
+       TokenFile               string
+       TLSTrustCertFile        string
+       MaxConnectionsPerBroker int
 }
 
 var clientArgs ClientArgs
 
 func NewClient() (pulsar.Client, error) {
        clientOpts := pulsar.ClientOptions{
-               URL: clientArgs.ServiceURL,
+               URL:                     clientArgs.ServiceURL,
+               MaxConnectionsPerBroker: clientArgs.MaxConnectionsPerBroker,
        }
 
        if clientArgs.TokenFile != "" {
@@ -97,6 +99,8 @@ func main() {
                "pulsar://localhost:6650", "The Pulsar service URL")
        flags.StringVar(&clientArgs.TokenFile, "token-file", "", "file path to 
the Pulsar JWT file")
        flags.StringVar(&clientArgs.TLSTrustCertFile, "trust-cert-file", "", 
"file path to the trusted certificate file")
+       flags.IntVarP(&clientArgs.MaxConnectionsPerBroker, "max-connections", 
"c", 1,
+               "Max connections to open to broker. Defaults to 1.")
 
        rootCmd.AddCommand(newProducerCommand())
        rootCmd.AddCommand(newConsumerCommand())

Reply via email to