mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@582086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3d633c2a9
commit
e2ef8b8165
|
@ -782,6 +782,15 @@ public class BrokerService implements Service {
|
||||||
this.managementContext = managementContext;
|
this.managementContext = managementContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NetworkConnector getNetworkConnectorByName(String connectorName) {
|
||||||
|
for(NetworkConnector connector : networkConnectors) {
|
||||||
|
if(connector.getName().equals(connectorName)) {
|
||||||
|
return connector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getNetworkConnectorURIs() {
|
public String[] getNetworkConnectorURIs() {
|
||||||
return networkConnectorURIs;
|
return networkConnectorURIs;
|
||||||
}
|
}
|
||||||
|
@ -790,6 +799,15 @@ public class BrokerService implements Service {
|
||||||
this.networkConnectorURIs = networkConnectorURIs;
|
this.networkConnectorURIs = networkConnectorURIs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TransportConnector getConnectorByName(String connectorName) {
|
||||||
|
for(TransportConnector connector : transportConnectors) {
|
||||||
|
if(connector.getName().equals(connectorName)) {
|
||||||
|
return connector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getTransportConnectorURIs() {
|
public String[] getTransportConnectorURIs() {
|
||||||
return transportConnectorURIs;
|
return transportConnectorURIs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,14 @@ import javax.management.ObjectName;
|
||||||
import org.apache.activemq.broker.Broker;
|
import org.apache.activemq.broker.Broker;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.ConnectionContext;
|
import org.apache.activemq.broker.ConnectionContext;
|
||||||
|
import org.apache.activemq.broker.TransportConnector;
|
||||||
import org.apache.activemq.broker.region.Subscription;
|
import org.apache.activemq.broker.region.Subscription;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
import org.apache.activemq.command.ConsumerId;
|
import org.apache.activemq.command.ConsumerId;
|
||||||
import org.apache.activemq.command.ConsumerInfo;
|
import org.apache.activemq.command.ConsumerInfo;
|
||||||
import org.apache.activemq.command.RemoveSubscriptionInfo;
|
import org.apache.activemq.command.RemoveSubscriptionInfo;
|
||||||
|
import org.apache.activemq.network.NetworkConnector;
|
||||||
//import org.apache.log4j.LogManager;
|
//import org.apache.log4j.LogManager;
|
||||||
//import org.apache.log4j.PropertyConfigurator;
|
//import org.apache.log4j.PropertyConfigurator;
|
||||||
|
|
||||||
|
@ -156,6 +158,30 @@ public class BrokerView implements BrokerViewMBean {
|
||||||
return broker.getInactiveDurableTopicSubscribers();
|
return broker.getInactiveDurableTopicSubscribers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String addConnector(String discoveryAddress) throws Exception {
|
||||||
|
TransportConnector connector = brokerService.addConnector(discoveryAddress);
|
||||||
|
connector.start();
|
||||||
|
return connector.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addNetworkConnector(String discoveryAddress) throws Exception {
|
||||||
|
NetworkConnector connector = brokerService.addNetworkConnector(discoveryAddress);
|
||||||
|
connector.start();
|
||||||
|
return connector.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeConnector(String connectorName) throws Exception {
|
||||||
|
TransportConnector connector = brokerService.getConnectorByName(connectorName);
|
||||||
|
connector.stop();
|
||||||
|
return brokerService.removeConnector(connector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeNetworkConnector(String connectorName) throws Exception {
|
||||||
|
NetworkConnector connector = brokerService.getNetworkConnectorByName(connectorName);
|
||||||
|
connector.stop();
|
||||||
|
return brokerService.removeNetworkConnector(connector);
|
||||||
|
}
|
||||||
|
|
||||||
public void addTopic(String name) throws Exception {
|
public void addTopic(String name) throws Exception {
|
||||||
broker.addDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQTopic(name));
|
broker.addDestination(getConnectionContext(broker.getContextBroker()), new ActiveMQTopic(name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,14 @@ public interface BrokerViewMBean extends Service {
|
||||||
|
|
||||||
ObjectName[] getTemporaryQueueSubscribers();
|
ObjectName[] getTemporaryQueueSubscribers();
|
||||||
|
|
||||||
|
String addConnector(String discoveryAddress) throws Exception;
|
||||||
|
|
||||||
|
String addNetworkConnector(String discoveryAddress) throws Exception;
|
||||||
|
|
||||||
|
boolean removeConnector(String connectorName) throws Exception;
|
||||||
|
|
||||||
|
boolean removeNetworkConnector(String connectorName) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Topic destination to the broker.
|
* Adds a Topic destination to the broker.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue