-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client #9975
Changes from 3 commits
cb10b7a
cfa139f
b7a4765
b9ce866
bb271ea
95c6913
be79b07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* 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; | ||
|
||
/** | ||
* Pulsar version entry point. | ||
*/ | ||
public class PulsarVersionStarter { | ||
|
||
public static void main(String args[]) { | ||
System.out.println("Current version of pulsar is: " + PulsarVersion.getVersion()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,15 @@ void run() throws Exception { | |
|
||
} | ||
|
||
@Parameters(commandDescription = "Get the version of the currently connected broker") | ||
private class PulsarVersion extends CliCommand { | ||
|
||
@Override | ||
void run() throws Exception { | ||
System.out.println( getAdmin().brokers().getVersion()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that we have a little usability problem here. The user does not know which broker reported the version. Proposals:
In a Pulsar cluster usually you have the same version of the software, but this may not be the case during upgrades or in case you have special versions of Pulsar on some nodes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I agree with you, but I think the current version of the broker can be queried explicitly using the |
||
} | ||
} | ||
|
||
public CmdBrokers(Supplier<PulsarAdmin> admin) { | ||
super("brokers", admin); | ||
jcommander.addCommand("list", new List()); | ||
|
@@ -159,5 +168,6 @@ public CmdBrokers(Supplier<PulsarAdmin> admin) { | |
jcommander.addCommand("get-runtime-config", new GetRuntimeConfigCmd()); | ||
jcommander.addCommand("healthcheck", new HealthcheckCmd()); | ||
jcommander.addCommand("backlog-quota-check", new BacklogQuotaCheckCmd()); | ||
jcommander.addCommand("version", new PulsarVersion()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I found that other commands such as
pulsar broker
,pulsar proxy
are a public class with amain
function,pulsar version
as a separate command, also needs to be a class with amain
function, otherwise, it needs to be a subcommand of other commands