Package org.activemq.transport

Examples of org.activemq.transport.NetworkConnector


            if (brokerConnector == null) {
                BrokerContainer container = new BrokerContainerImpl(brokerName, serviceName);
                if( !persistent ) {
                    container.setPersistenceAdapter(new VMPersistenceAdapter());
                }
                NetworkConnector networkConnector = null;
                if (doDiscovery) {
                    networkConnector = new DiscoveryNetworkConnector(container);
                    MulticastDiscoveryAgent agent = new MulticastDiscoveryAgent(serviceName);
                    container.setDiscoveryAgent(agent);
                }
                if (peerURIs != null && peerURIs.length() > 0) {
                    URIHelper peers = new URIHelper(peerURIs);
                    networkConnector = createNetworkConnector(container);
                    while (peers.hasNext()) {
                        String peerURL  = peers.getNext();
                        networkConnector.addNetworkChannel(peerURL);
                    }
                }
                container.addNetworkConnector(networkConnector);
                URIHelper helper = new URIHelper(brokerConnectorURI);
                brokerConnector = new BrokerConnectorImpl(container, helper.getNext(), wireFormat);
View Full Code Here


     * Create a NetworkConnector
     * @param container
     * @return the NetworkConnector
     */
    protected NetworkConnector createNetworkConnector(BrokerContainer container){
        return new NetworkConnector(container);
    }
View Full Code Here

        assertTrue("Created correct wireFormat: " + tcpChannel2.getWireFormat(), tcpChannel2.getWireFormat() instanceof WireFormatStub);


        List networkConnectors = container.getNetworkConnectors();
        assertEquals("Should have a single network connector", 1, networkConnectors.size());
        NetworkConnector networkConnector = (NetworkConnector) networkConnectors.get(0);
        ActiveMQPrefetchPolicy localPrefetchPolicy = networkConnector.getLocalPrefetchPolicy();
        assertNotNull("localPrefetchPolicy", localPrefetchPolicy);
        assertEquals("localPrefetchPolicy.getQueuePrefetch", 1, localPrefetchPolicy.getQueuePrefetch());
        assertEquals("localPrefetchPolicy.getQueueBrowserPrefetch", 2, localPrefetchPolicy.getQueueBrowserPrefetch());

        ActiveMQPrefetchPolicy remotePrefetchPolicy = networkConnector.getRemotePrefetchPolicy();
        assertNotNull("remotePrefetchPolicy", remotePrefetchPolicy);
        assertEquals("remotePrefetchPolicy.getTopicPrefetch", 3, remotePrefetchPolicy.getTopicPrefetch());
        assertEquals("remotePrefetchPolicy.getDurableTopicPrefetch", 4, remotePrefetchPolicy.getDurableTopicPrefetch());


        List networkChannels = networkConnector.getNetworkChannels();
        assertEquals("Should have 2 network channels", 2, networkChannels.size());

        NetworkChannel networkChannel = (NetworkChannel) networkChannels.get(0);
        assertEquals("URL not equal", "tcp://somehost:61616", networkChannel.getUri());
        assertEquals("remoteUserName", "James", networkChannel.getRemoteUserName());
View Full Code Here

    public void setNetworkConnectors(List networkConnectors) {
        this.networkConnectors = new CopyOnWriteArrayList(networkConnectors);
    }

    public NetworkConnector addNetworkConnector(String uri) throws JMSException {
        NetworkConnector connector = addNetworkConnector();
        connector.addNetworkChannel(uri);
        return connector;
    }
View Full Code Here

        connector.addNetworkChannel(uri);
        return connector;
    }

    public NetworkConnector addNetworkConnector() {
        NetworkConnector connector = new NetworkConnector(this);
        addNetworkConnector(connector);
        return connector;
    }
View Full Code Here

        if (clusterName.equals(info.getClusterName())) {
            clusteredConnection = true;
        }
        if (!remoteNetworkConnector && info.isRemote()) {
            try {
                final NetworkConnector networkConnector = new NetworkConnector(brokerConnector.getBrokerContainer());
                networkConnector.getThreadPool().execute(new Runnable() {
                    public void run() {
                        try {
                            NetworkChannel networkChannel = new NetworkChannel(networkConnector, brokerConnector
                                    .getBrokerContainer(), channel, info.getBrokerName(), info.getClusterName());
                            networkConnector.addNetworkChannel(networkChannel);
                            brokerConnector.getBrokerContainer().addNetworkConnector(networkConnector);
                            networkConnector.start();
                        }
                        catch (JMSException e) {
                            log.error("Failed to create reverse remote channel", e);
                        }
                    }
View Full Code Here

        if (clusterName.equals(info.getClusterName())) {
            clusteredConnection = true;
        }
        if (!remoteNetworkConnector && info.isRemote()) {
            try {
                final NetworkConnector networkConnector = new NetworkConnector(brokerConnector.getBrokerContainer());
                networkConnector.getThreadPool().execute(new Runnable() {
                    public void run() {
                        try {
                            NetworkChannel networkChannel = new NetworkChannel(networkConnector, brokerConnector
                                    .getBrokerContainer(), channel, info.getBrokerName(), info.getClusterName());
                            networkConnector.addNetworkChannel(networkChannel);
                            brokerConnector.getBrokerContainer().addNetworkConnector(networkConnector);
                            networkConnector.start();
                        }
                        catch (JMSException e) {
                            log.error("Failed to create reverse remote channel", e);
                        }
                    }
View Full Code Here

    public void setNetworkConnectors(List networkConnectors) {
        this.networkConnectors = new CopyOnWriteArrayList(networkConnectors);
    }

    public NetworkConnector addNetworkConnector(String uri) throws JMSException {
        NetworkConnector connector = addNetworkConnector();
        connector.addNetworkChannel(uri);
        return connector;
    }
View Full Code Here

        connector.addNetworkChannel(uri);
        return connector;
    }

    public NetworkConnector addNetworkConnector() {
        NetworkConnector connector = new NetworkConnector(this);
        addNetworkConnector(connector);
        return connector;
    }
View Full Code Here

        if (clusterName.equals(info.getClusterName())) {
            clusteredConnection = true;
        }
        if (!remoteNetworkConnector && info.isRemote()) {
            try {
                final NetworkConnector networkConnector = new NetworkConnector(brokerConnector.getBrokerContainer());
                networkConnector.getThreadPool().execute(new Runnable() {
                    public void run() {
                        try {
                            NetworkChannel networkChannel = new NetworkChannel(networkConnector, brokerConnector
                                    .getBrokerContainer(), channel, info.getBrokerName(), info.getClusterName());
                            networkConnector.addNetworkChannel(networkChannel);
                            brokerConnector.getBrokerContainer().addNetworkConnector(networkConnector);
                            networkConnector.start();
                        }
                        catch (JMSException e) {
                            log.error("Failed to create reverse remote channel", e);
                        }
                    }
View Full Code Here

TOP

Related Classes of org.activemq.transport.NetworkConnector

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.