public void resendLive() { if (!stopping && started) { topology.resendNode(manager.getNodeId()); } } }
private TopologyMember getLocalMember() { return topology.getMember(manager.getNodeId()); }
@Override public void onConnection(ClientSessionFactoryInternal sf) { TopologyMember localMember = getLocalMember(); if (localMember != null) { ClusterControl clusterControl = manager.getClusterController().connectToNodeInCluster(sf); try { clusterControl.authorize(); clusterControl.sendNodeAnnounce(localMember.getUniqueEventID(), manager.getNodeId(), manager.getBackupGroupName(), manager.getScaleDownGroupName(), false, localMember.getLive(), localMember.getBackup()); } catch (ActiveMQException e) { ActiveMQServerLogger.LOGGER.clusterControlAuthfailure(); } } else { ActiveMQServerLogger.LOGGER.noLocalMemborOnClusterConnection(this); } // TODO: shouldn't we send the current time here? and change the current topology? // sf.sendNodeAnnounce(System.currentTimeMillis(), // manager.getNodeId(), // false, // localMember.getConnector().a, // localMember.getConnector().b); }
final TopologyMember currentMember = topology.getMember(manager.getNodeId());
setupSessionFactory(2, isNetty(), false, servers[2].getConfiguration().getClusterUser(), servers[2].getConfiguration().getClusterPassword()); IntegrationTestLogger.LOGGER.info("==============================="); IntegrationTestLogger.LOGGER.info("Node 0: " + servers[0].getClusterManager().getNodeId()); IntegrationTestLogger.LOGGER.info("Node 1: " + servers[1].getClusterManager().getNodeId()); IntegrationTestLogger.LOGGER.info("Node 2: " + servers[2].getClusterManager().getNodeId()); IntegrationTestLogger.LOGGER.info("===============================");
@Test public void testBasicLocalReceive() throws Exception { startServers(1, 0); setupSessionFactory(0, isNetty(), true); setupSessionFactory(1, isNetty(), true); createQueue(0, "queues.testaddress", "queue0", null, false); addConsumer(0, 0, "queue0", null); waitForBindings(0, "queues.testaddress", 1, 1, true); send(0, "queues.testaddress", 10, false, null); verifyReceiveAll(10, 0); verifyNotReceive(0); addConsumer(1, 0, "queue0", null); verifyNotReceive(1); //Should be 0 as no messages were sent to the second broker verifyClusterMetrics(0, "cluster1", 0, 0); //Should be 0 as no messages were sent to the first broker verifyClusterMetrics(1, "clusterX", 0, 0); //0 messages were sent across the bridge to the second broker verifyBridgeMetrics(0, "cluster1", servers[1].getClusterManager().getNodeId(), 0, 0); }
@Test public void testBasicRoundRobin() throws Exception { startServers(1, 0); setupSessionFactory(0, isNetty(), true); setupSessionFactory(1, isNetty(), true); createQueue(0, "queues.testaddress", "queue0", null, false); createQueue(1, "queues.testaddress", "queue0", null, false); addConsumer(0, 0, "queue0", null); addConsumer(1, 1, "queue0", null); waitForBindings(0, "queues.testaddress", 1, 1, true); waitForBindings(1, "queues.testaddress", 1, 1, true); waitForBindings(0, "queues.testaddress", 1, 1, false); waitForBindings(1, "queues.testaddress", 0, 0, false); send(0, "queues.testaddress", 10, false, null); verifyReceiveRoundRobin(10, 0, 1); verifyNotReceive(0, 1); //half of the messages should be sent over bridge, other half was consumed by local consumer verifyClusterMetrics(0, "cluster1", 5, 5); //Should be 0 as no messages were sent to the first broker verifyClusterMetrics(1, "clusterX", 0, 0); //5 messages were sent across the bridge to the second broker verifyBridgeMetrics(0, "cluster1", servers[1].getClusterManager().getNodeId(), 5, 5); }