Search in sources :

Example 11 with Topology

use of org.apache.activemq.artemis.core.client.impl.Topology in project activemq-artemis by apache.

the class ActiveMQTestBase method waitForTopology.

protected void waitForTopology(final ActiveMQServer server, String clusterConnectionName, final int nodes, final long timeout) throws Exception {
    logger.debug("waiting for " + nodes + " on the topology for server = " + server);
    long start = System.currentTimeMillis();
    ClusterConnection clusterConnection = server.getClusterManager().getClusterConnection(clusterConnectionName);
    Topology topology = clusterConnection.getTopology();
    do {
        if (nodes == topology.getMembers().size()) {
            return;
        }
        Thread.sleep(10);
    } while (System.currentTimeMillis() - start < timeout);
    String msg = "Timed out waiting for cluster topology of " + nodes + " (received " + topology.getMembers().size() + ") topology = " + topology + ")";
    ActiveMQServerLogger.LOGGER.error(msg);
    throw new Exception(msg);
}
Also used : ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) Topology(org.apache.activemq.artemis.core.client.impl.Topology) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) XAException(javax.transaction.xa.XAException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Aggregations

Topology (org.apache.activemq.artemis.core.client.impl.Topology)11 TopologyMemberImpl (org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl)9 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)7 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)6 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)5 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)4 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)4 Test (org.junit.Test)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)3 IOException (java.io.IOException)2 SQLException (java.sql.SQLException)2 XAException (javax.transaction.xa.XAException)2 ClusterConnectionImpl (org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl)2 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 JMSException (javax.jms.JMSException)1 JsonArrayBuilder (javax.json.JsonArrayBuilder)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1