Quote queue names so that web console shows correct results for queue`s producers/subscribers

This commit is contained in:
Yury Gubernatorov 2021-12-28 12:46:24 -08:00 committed by Jean-Baptiste Onofré
parent c0927c2937
commit bb375895de
1 changed files with 4 additions and 4 deletions

View File

@ -240,8 +240,8 @@ public abstract class BrokerFacadeSupport implements BrokerFacade {
public Collection<SubscriptionViewMBean> getQueueConsumers(String queueName) throws Exception {
String brokerName = getBrokerName();
queueName = StringUtils.replace(queueName, "\"", "_");
ObjectName query = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName
+ ",destinationType=Queue,destinationName=" + queueName + ",endpoint=Consumer,*");
ObjectName query = new ObjectName("org.apache.activemq:type=Broker,brokerName=\"" + brokerName
+ "\",destinationType=Queue,destinationName=\"" + queueName + "\",endpoint=Consumer,*");
Set<ObjectName> queryResult = queryNames(query, null);
return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), SubscriptionViewMBean.class);
}
@ -251,8 +251,8 @@ public abstract class BrokerFacadeSupport implements BrokerFacade {
public Collection<ProducerViewMBean> getQueueProducers(String queueName) throws Exception {
String brokerName = getBrokerName();
queueName = StringUtils.replace(queueName, "\"", "_");
ObjectName query = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName
+ ",destinationType=Queue,destinationName=" + queueName + ",endpoint=Producer,*");
ObjectName query = new ObjectName("org.apache.activemq:type=Broker,brokerName=\"" + brokerName
+ "\",destinationType=Queue,destinationName=\"" + queueName + "\",endpoint=Producer,*");
Set<ObjectName> queryResult = queryNames(query, null);
return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), ProducerViewMBean.class);
}