This is an automated email from the ASF dual-hosted git repository.
jlmonteiro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/main by this push:
new 899f353c77 [AMQ-9769] Add name property to connector interface and
MBean. (#1493)
899f353c77 is described below
commit 899f353c77f34a4a06106a33a4e82047d5db66a7
Author: Albertas Vyšniauskas <[email protected]>
AuthorDate: Wed Feb 11 17:55:24 2026 +0200
[AMQ-9769] Add name property to connector interface and MBean. (#1493)
* [AMQ-9769] Add name property to connector interface and MBean.
* [AMQ-9769] Use connector name property in web console.
* Add getConnectionId() to ConnectionViewMBeanAdd.
---
.../main/java/org/apache/activemq/broker/Connector.java | 4 ++++
.../org/apache/activemq/broker/jmx/ConnectionView.java | 1 +
.../apache/activemq/broker/jmx/ConnectionViewMBean.java | 8 ++++++++
.../org/apache/activemq/broker/jmx/ConnectorView.java | 4 ++++
.../apache/activemq/broker/jmx/ConnectorViewMBean.java | 3 +++
.../main/webapp/WEB-INF/tags/jms/forEachConnection.tag | 5 ++---
activemq-web-console/src/main/webapp/connections.jsp | 6 +++---
.../main/java/org/apache/activemq/web/BrokerFacade.java | 9 ++++-----
.../java/org/apache/activemq/web/BrokerFacadeSupport.java | 15 +++++----------
9 files changed, 34 insertions(+), 21 deletions(-)
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
index b099706a3d..bf6fd7bec7 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
@@ -111,4 +111,8 @@ public interface Connector extends Service {
public int getConnectionCount();
+ /**
+ * @return connector name
+ */
+ public String getName();
}
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
index 593c4f999e..6106471821 100644
---
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
+++
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
@@ -105,6 +105,7 @@ public class ConnectionView implements ConnectionViewMBean {
return connection.getConnectionId();
}
+ @Override
public String getConnectionId() {
return connection.getConnectionId();
}
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
index 77eb188f5d..6146fa92bf 100644
---
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
+++
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
@@ -68,6 +68,14 @@ public interface ConnectionViewMBean extends Service {
@MBeanInfo("client id for this connection")
String getClientId();
+ /**
+ * Returns the identifier for this connection
+ *
+ * @return the identifier for this connection
+ */
+ @MBeanInfo("ID for this connection")
+ String getConnectionId();
+
/**
* Returns the number of messages to be dispatched to this connection
* @return the number of messages pending dispatch
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
index dc5e184509..acd00377d0 100644
---
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
+++
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
@@ -230,4 +230,8 @@ public class ConnectorView implements ConnectorViewMBean {
return this.connector.connectionCount();
}
+ @Override
+ public String getName() {
+ return this.connector.getName();
+ }
}
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
index 8d3ff5ec55..4d04022561 100644
---
a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
+++
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
@@ -145,4 +145,7 @@ public interface ConnectorViewMBean extends Service {
@MBeanInfo("Connection count")
public int getConnectionCount();
+
+ @MBeanInfo("Connector name")
+ String getName();
}
diff --git
a/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/forEachConnection.tag
b/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/forEachConnection.tag
index 6b6af7e3a2..dfa333ca67 100644
---
a/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/forEachConnection.tag
+++
b/activemq-web-console/src/main/webapp/WEB-INF/tags/jms/forEachConnection.tag
@@ -23,9 +23,8 @@
<%
Iterator it = broker.getConnections(connectorName).iterator();
while (it.hasNext()) {
- String conName = (String) it.next();
- ConnectionViewMBean con = broker.getConnection(conName);
- request.setAttribute(connectionName, conName);
+ ConnectionViewMBean con = (ConnectionViewMBean) it.next();
+ request.setAttribute(connectionName, con.getClientId());
request.setAttribute(connection, con);
%>
<jsp:doBody/>
diff --git a/activemq-web-console/src/main/webapp/connections.jsp
b/activemq-web-console/src/main/webapp/connections.jsp
index be280edeed..fe75bce9e7 100644
--- a/activemq-web-console/src/main/webapp/connections.jsp
+++ b/activemq-web-console/src/main/webapp/connections.jsp
@@ -28,8 +28,8 @@
<h2>Connections</h2>
-<c:forEach items="${requestContext.brokerQuery.connectors}"
var="connectorName">
-<h3>Connector <c:out value="${connectorName}" /></h3>
+<c:forEach items="${requestContext.brokerQuery.connectors}" var="connector">
+<h3>Connector <c:out value="${connector.name}" /></h3>
<table id="connections" class="sortable autostripe">
<thead>
@@ -41,7 +41,7 @@
</tr>
</thead>
<tbody>
-<jms:forEachConnection broker="${requestContext.brokerQuery}"
connectorName="${connectorName}"
+<jms:forEachConnection broker="${requestContext.brokerQuery}"
connectorName="${connector.name}"
connection="con" connectionName="conName">
<tr>
diff --git
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
index 720ebcbb16..5f3646a82e 100644
--- a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
+++ b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
@@ -134,12 +134,12 @@ public interface BrokerFacade {
throws Exception;
/**
- * The names of all transport connectors of the broker (f.e. openwire,
ssl)
+ * All transport connectors of the broker (f.e. openwire, ssl)
*
* @return not <code>null</code>
* @throws Exception
*/
- Collection<String> getConnectors() throws Exception;
+ Collection<ConnectorViewMBean> getConnectors() throws Exception;
/**
* A transport connectors.
@@ -160,8 +160,7 @@ public interface BrokerFacade {
Collection<ConnectionViewMBean> getConnections() throws Exception;
/**
- * The names of all connections to a specific transport connectors of
the
- * broker.
+ * All connections to a specific transport connectors of the broker.
*
* @see #getConnection(String)
* @param connectorName
@@ -169,7 +168,7 @@ public interface BrokerFacade {
* @return not <code>null</code>
* @throws Exception
*/
- Collection<String> getConnections(String connectorName) throws
Exception;
+ Collection<ConnectionViewMBean> getConnections(String connectorName)
throws Exception;
/**
* A specific connection to the broker.
diff --git
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
index ee090a2907..efab98a379 100644
---
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
+++
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
@@ -169,18 +169,14 @@ public abstract class BrokerFacadeSupport implements
BrokerFacade {
@Override
@SuppressWarnings("unchecked")
- public Collection<String> getConnections(String connectorName) throws
Exception {
+ public Collection<ConnectionViewMBean> getConnections(String
connectorName) throws Exception {
String brokerName = getBrokerName();
connectorName = JMXSupport.encodeObjectNamePart(connectorName);
ObjectName query = new
ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName
+ ",connector=clientConnectors,connectorName=" + connectorName +
",connectionViewType=clientId,connectionName=*");
Set<ObjectName> queryResult = queryNames(query, null);
- Collection<ConnectionViewMBean> connections =
getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]),
+ return getManagedObjects(queryResult.toArray(new
ObjectName[queryResult.size()]),
ConnectionViewMBean.class);
- Collection<String> result = new ArrayList<String>(queryResult.size());
- for (ConnectionViewMBean connection : connections)
- result.add(connection.getClientId());
- return result;
}
@Override
@@ -200,14 +196,13 @@ public abstract class BrokerFacadeSupport implements
BrokerFacade {
@Override
@SuppressWarnings("unchecked")
- public Collection<String> getConnectors() throws Exception {
+ public Collection<ConnectorViewMBean> getConnectors() throws Exception {
String brokerName = getBrokerName();
ObjectName query = new
ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName +
",connector=clientConnectors,connectorName=*");
Set<ObjectName> queryResult = queryNames(query, null);
Collection<String> result = new ArrayList<String>(queryResult.size());
- for (ObjectName on : queryResult)
- result.add(on.getKeyProperty("connectorName"));
- return result;
+ return getManagedObjects(queryResult.toArray(new
ObjectName[queryResult.size()]),
+ ConnectorViewMBean.class);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact