Package org.apache.activemq.broker

Examples of org.apache.activemq.broker.TransportConnector


      exception = null;
    bs = new BrokerService();
    bs.setDeleteAllMessagesOnStartup(true);
    bs.setPersistent(true);
    bs.setUseJmx(true);
    TransportConnector connector = bs.addConnector("tcp://localhost:0");
    bs.start();
    tcpUri = connector.getConnectUri();

    cf = new ActiveMQConnectionFactory("failover://(" + tcpUri + ")");

    sendMessagesToQueue();
  }
View Full Code Here


    public ObjectName[] getInactiveDurableTopicSubscribers() {
        return broker.getInactiveDurableTopicSubscribers();
    }

    public String addConnector(String discoveryAddress) throws Exception {
        TransportConnector connector = brokerService.addConnector(discoveryAddress);
        connector.start();
        return connector.getName();
    }
View Full Code Here

        connector.start();
        return connector.getName();
    }

    public boolean removeConnector(String connectorName) throws Exception {
        TransportConnector connector = brokerService.getConnectorByName(connectorName);
        connector.stop();
        return brokerService.removeConnector(connector);
    }
View Full Code Here

    }
   
    protected void configureConsumerBroker(BrokerService answer,String uri) throws Exception {
        answer.setBrokerName(BROKER_A_NAME);
        answer.setPersistent(false);
        TransportConnector connector = answer.addConnector(uri);
        connector.setRebalanceClusterClients(true);
        connector.setUpdateClusterClients(true);
        answer.setUseShutdownHook(false);
    }
View Full Code Here

    protected void configureNetwork(BrokerService answer,String uri) throws Exception {
        answer.setBrokerName(BROKER_B_NAME);
        answer.setPersistent(false);
        NetworkConnector network = answer.addNetworkConnector("static://"+BROKER_A_BIND_ADDRESS);
        network.setDuplex(true);
        TransportConnector connector =answer.addConnector(uri);
        connector.setRebalanceClusterClients(true);
        connector.setUpdateClusterClients(true);
        answer.setUseShutdownHook(false);
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        bs = new BrokerService();
        bs.setPersistent(false);
        bs.setUseJmx(true);
        TransportConnector connector = bs.addConnector("tcp://localhost:0");
        bs.start();
        tcpUri = connector.getConnectUri();

        workers = new Worker[WORKER_COUNT];
        for (int i = 0; i < WORKER_COUNT; i++) {
            workers[i] = new Worker(""+i);
            workers[i].start();
View Full Code Here

                }
               
                server=(VMTransportServer) servers.get(host);
                if(server==null){
                    server=(VMTransportServer) bind(location,true);
                    TransportConnector connector=new TransportConnector(broker.getBroker(),server);
                    connector.setUri(location);
                    connector.setTaskRunnerFactory( broker.getTaskRunnerFactory() );
                    connector.start();
                    connectors.put(host,connector);
                }
               
            }
        }
View Full Code Here

    }

    public static void stopped(VMTransportServer server){
        String host=server.getBindURI().getHost();
        servers.remove(host);
        TransportConnector connector=(TransportConnector) connectors.remove(host);
        if(connector!=null){
            log.debug("Shutting down VM connectors for broker: "  +host);
            ServiceSupport.dispose(connector);
            BrokerService broker=(BrokerService) brokers.remove(host);
            if(broker!=null){
View Full Code Here

        }
    }

    public static void stopped(String host){
        servers.remove(host);
        TransportConnector connector=(TransportConnector) connectors.remove(host);
        if(connector!=null){
            log.debug("Shutting down VM connectors for broker: "  +host);
            ServiceSupport.dispose(connector);
            BrokerService broker=(BrokerService) brokers.remove(host);
            if(broker!=null){
View Full Code Here

    private boolean validateBroker(String host){
        boolean result=true;
        if(brokers.containsKey(host)||servers.containsKey(host)||connectors.containsKey(host)){
            // check the broker is still in the BrokerRegistry
            TransportConnector connector=(TransportConnector) connectors.get(host);
            if(BrokerRegistry.getInstance().lookup(host)==null||(connector!=null&&connector.getBroker().isStopped())){
                result=false;
                // clean-up
                brokers.remove(host);
                servers.remove(host);
                if(connector!=null){
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.TransportConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.