@Override public boolean removeConnector(String connectorName) throws Exception { TransportConnector connector = brokerService.getConnectorByName(connectorName); if (connector == null) { throw new NoSuchElementException("Not connector matched the given name: " + connectorName); } connector.stop(); return brokerService.removeConnector(connector); }
@Test public void testAMQ5050DefaultHost() throws Exception { // Let verify a host header is added to the connection. Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection(); connection.start(); CopyOnWriteArrayList<TransportConnection> connections = broker.getConnectorByName("tcp").getConnections(); assertEquals(1, connections.size()); assertNotNull(connections.get(0).getRemoteWireFormatInfo().getHost()); connection.stop(); }
@Test public void testAMQ5050WithManualSpecifiedHost() throws Exception { // Let verify a host header is added to the connection. Connection connection = new ActiveMQConnectionFactory(brokerConnectURI+"?wireFormat.host=foo").createConnection(); connection.start(); CopyOnWriteArrayList<TransportConnection> connections = broker.getConnectorByName("tcp").getConnections(); assertEquals(1, connections.size()); assertEquals("foo", connections.get(0).getRemoteWireFormatInfo().getHost()); connection.stop(); }
@Before public void startBroker() throws Exception { broker = new BrokerService(); broker.setPersistent(false); TransportConnector connector = broker.addConnector(new TransportConnector()); connector.setUri(new URI("tcp://0.0.0.0:0")); connector.setName("tcp"); broker.start(); broker.waitUntilStarted(); brokerConnectURI = broker.getConnectorByName("tcp").getConnectUri(); }
@Override public boolean removeConnector(String connectorName) throws Exception { TransportConnector connector = brokerService.getConnectorByName(connectorName); if (connector == null) { throw new NoSuchElementException("Not connector matched the given name: " + connectorName); } connector.stop(); return brokerService.removeConnector(connector); }
@Override public boolean removeConnector(String connectorName) throws Exception { TransportConnector connector = brokerService.getConnectorByName(connectorName); if (connector == null) { throw new NoSuchElementException("Not connector matched the given name: " + connectorName); } connector.stop(); return brokerService.removeConnector(connector); }
@Override public boolean removeConnector(String connectorName) throws Exception { TransportConnector connector = brokerService.getConnectorByName(connectorName); if (connector == null) { throw new NoSuchElementException("Not connector matched the given name: " + connectorName); } connector.stop(); return brokerService.removeConnector(connector); }
private void registerConnectors() throws Exception { List<String> services = new LinkedList<String>(); for (String name : connectors) { TransportConnector connector = server.getBroker().getConnectorByName(name); if (connector == null) { warn("ActiveMQ broker '%s' does not have a connector called '%s'", name, name); } else { services.add(connector.getConnectUri().getScheme() + "://${zk:" + System.getProperty("runtime.id") + "/ip}:" + connector.getPublishableConnectURI().getPort()); } } discoveryAgent.setServices(services.toArray(new String[services.size()])); }
public boolean removeConnector(String connectorName) throws Exception { TransportConnector connector = brokerService.getConnectorByName(connectorName); connector.stop(); return brokerService.removeConnector(connector); }
private void registerConnectors() throws Exception { List<String> services = new LinkedList<String>(); for (String name : connectors) { TransportConnector connector = server.getBroker().getConnectorByName(name); if (connector == null) { LOG.warn("ActiveMQ broker '" + server.getBroker().getBrokerName() + "' does not have a connector called '" + name + "'"); } else { String ip = (String) properties.get("container.ip"); if( ip==null ) { ip = "${zk:" + System.getProperty("runtime.id") + "/ip}"; } services.add(connector.getConnectUri().getScheme() + "://" + ip + ":" + connector.getPublishableConnectURI().getPort()); } } discoveryAgent.setServices(services.toArray(new String[services.size()])); }