Package org.apache.activemq.broker

Examples of org.apache.activemq.broker.TransportConnector


    private ActiveMQQueue queue;

    protected void setUp() throws Exception {
        broker = new BrokerService();

        TransportConnector tc = new TransportConnector();
        tc.setUri(new URI(BROKER_URL));
        tc.setName("tcp");

        queue = new ActiveMQQueue("TEST." + System.currentTimeMillis());

        broker.addConnector(tc);
        broker.start();
View Full Code Here


    private static final Logger LOG = LoggerFactory.getLogger(DiscoveryTransportNoBrokerTest.class);

    public void testNoExtraThreads() throws Exception {
        BrokerService broker = new BrokerService();
        TransportConnector tcp = broker.addConnector("tcp://localhost:0?transport.closeAsync=false");
        String group = "GR-" +  System.currentTimeMillis();
        URI discoveryUri = new URI("multicast://default?group=" + group);
        tcp.setDiscoveryUri(discoveryUri);
        broker.start();
        broker.waitUntilStarted();
       
        Vector<String> existingNames = new Vector<String>();
        Thread[] threads = getThreads();
View Full Code Here

    }

    public void testCreateTcpConnectionUsingKnownLocalPort() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(false);
        TransportConnector connector = broker.addConnector("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
        broker.start();

        // This should create the connection.
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61610/localhost:51610");
        connection = (ActiveMQConnection)cf.createConnection();
View Full Code Here

    protected void assertCreateConnection(String uri) throws Exception {
        // Start up a broker with a tcp connector.
        broker = new BrokerService();
        broker.setPersistent(false);
        TransportConnector connector = broker.addConnector(uri);
        broker.start();

        URI temp = new URI(uri);
        // URI connectURI = connector.getServer().getConnectURI();
        // TODO this sometimes fails when using the actual local host name
        URI currentURI = connector.getServer().getConnectURI();

        // sometimes the actual host name doesn't work in this test case
        // e.g. on OS X so lets use the original details but just use the actual
        // port
        URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(),
View Full Code Here

        FailoverTransport ft = connection3.getTransport().narrow(FailoverTransport.class);

        // See which broker we were connected to.
        StubConnection connectionA;
        StubConnection connectionB;
        TransportConnector serverA;
        if (connector.getServer().getConnectURI().equals(ft.getConnectedTransportURI())) {
            connectionA = connection1;
            connectionB = connection2;
            serverA = connector;
        } else {
            connectionA = connection2;
            connectionB = connection1;
            serverA = remoteConnector;
        }

        assertNotNull(receiveMessage(connectionA));
        assertNoMessagesLeft(connectionB);

        // Dispose the server so that it fails over to the other server.
        LOG.info("Disconnecting the active connection");
        serverA.stop();

        connection3.request(createMessage(producerInfo3, destination, deliveryMode));

        assertNotNull(receiveMessage(connectionB));
        assertNoMessagesLeft(connectionA);
View Full Code Here

            if (transportConnectors.isEmpty()) {
                broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
                transportConnectors = broker.getTransportConnectors();
            }

            TransportConnector transport = transportConnectors.get(0);
            if (transport.getDiscoveryUri() == null) {
                transport.setDiscoveryUri(new URI("multicast://default?group=" + groupName));
            }

            List<NetworkConnector> networkConnectors = broker.getNetworkConnectors();
            if (networkConnectors.isEmpty()) {
                broker.addNetworkConnector("multicast://default?group=" + groupName);
View Full Code Here

        BrokerService answer = new BrokerService();
        answer.setPersistent(false);
        answer.setDeleteAllMessagesOnStartup(true);
        answer.setSchedulerSupport(false);
        answer.setUseJmx(true);
        TransportConnector connector = answer.addConnector("tcp://localhost:0");
        tcpUri = connector.getConnectUri();
        return answer;
    }
View Full Code Here

    public void testAutoUpdateURIs() throws Exception {

        BrokerService bs1 = new BrokerService();
        bs1.setUseJmx(false);
        TransportConnector transportConnector = bs1.addConnector(firstTcpUri);
        transportConnector.setUpdateClusterClients(true);
        bs1.start();

        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + firstTcpUri + ")");
        Connection connection = cf.createConnection();
        connection.start();
View Full Code Here

        BrokerService broker = new BrokerService();
        broker.setUseJmx(false);
        broker.getManagementContext().setCreateConnector(false);
        broker.setBrokerName("Broker_Shared");
        // lazy create transport connector on start completion
        TransportConnector connector = new TransportConnector();
        connector.setUri(new URI("tcp://localhost:" + listenPort));
        broker.addConnector(connector);
        broker.setDataDirectory(dataDir);
        return broker;
    }
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

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.