-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[AMQ-9815] Add additional attributes to ConnectorView #1556
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
| import org.apache.activemq.broker.Connector; | ||
| import org.apache.activemq.command.BrokerInfo; | ||
|
|
||
| import java.net.URI; | ||
|
|
||
| public class ConnectorView implements ConnectorViewMBean { | ||
|
|
||
| private final Connector connector; | ||
|
|
@@ -151,4 +153,82 @@ public boolean isAutoStart() { | |
| public boolean isStarted() { | ||
| return this.connector.isStarted(); | ||
| } | ||
|
|
||
| @Override | ||
| public String getConnectURI() { | ||
| URI tmpConnectUri = null; | ||
| try { | ||
| tmpConnectUri = this.connector.getConnectUri(); | ||
| } catch (Exception e) {} | ||
| return (tmpConnectUri != null ? tmpConnectUri.toString() : null); | ||
| } | ||
|
|
||
| @Override | ||
| public String getPublishableConnectURI() { | ||
| URI publishableConnectURI = null; | ||
| try { | ||
| publishableConnectURI = this.connector.getPublishableConnectURI(); | ||
|
Contributor
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. Same as previous |
||
| } catch (Exception e) {} | ||
|
|
||
| return (publishableConnectURI != null ? publishableConnectURI.toString() : null); | ||
| } | ||
|
|
||
| @Override | ||
| public String getBrokerInfoString() { | ||
| var tmpBrokerInfo = this.connector.getBrokerInfo(); | ||
| return (tmpBrokerInfo != null ? tmpBrokerInfo.toString() : null); | ||
|
Contributor
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. if getBrokerInfo() can really return null, you probably could add a null check above in other methods.
Contributor
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. There is a getBrokerInfo() method already available |
||
|
|
||
| } | ||
|
|
||
| /** | ||
| * Returns true the status monitor is enabled | ||
| * | ||
| * @return true if status monitor is enabled | ||
| */ | ||
| @Override | ||
| public boolean isEnableStatusMonitor() { | ||
| return this.connector.isEnableStatusMonitor(); | ||
| } | ||
|
|
||
| @Override | ||
| public String getURI() { | ||
| URI tmpURI = this.connector.getUri(); | ||
| return (tmpURI != null ? tmpURI.toString() : null); | ||
| } | ||
|
|
||
| @Override | ||
| public String getDiscoveryURI() { | ||
| URI tmpDiscoveryURI = this.connector.getDiscoveryUri(); | ||
| return (tmpDiscoveryURI != null ? tmpDiscoveryURI.toString() : null); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isAuditNetworkProducers() { | ||
| return this.connector.isAuditNetworkProducers(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the number of maximum producers allowed per-connection | ||
| */ | ||
| @Override | ||
| public int getMaximumProducersAllowedPerConnection() { | ||
| return this.connector.getMaximumProducersAllowedPerConnection(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the number of maximum consumers allowed per-connection | ||
| */ | ||
| @Override | ||
| public int getMaximumConsumersAllowedPerConnection() { | ||
| return this.connector.getMaximumConsumersAllowedPerConnection(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the number of current connections | ||
| */ | ||
| @Override | ||
| public int getConnectionCount() { | ||
| return this.connector.connectionCount(); | ||
| } | ||
|
|
||
| } | ||
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.
I find it more readable to do a return this.connector.getConnectUri() and return null in the catch block.