Sample code for joinSeedNodes programatically #24041

This commit is contained in:
Richard Imaoka 2018-04-30 17:21:35 +09:00 committed by Johan Andrén
parent a9be6ea1d2
commit e343222505
3 changed files with 47 additions and 7 deletions

View file

@ -6,14 +6,21 @@ package jdocs.cluster;
import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import jdocs.AbstractJavaTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import akka.actor.ActorSystem;
//#join-seed-nodes-imports
import akka.actor.Address;
import akka.cluster.Cluster;
//#join-seed-nodes-imports
import akka.actor.ActorSystem;
import akka.cluster.Member;
@ -57,4 +64,13 @@ public class ClusterDocTest extends AbstractJavaTest {
//#dcAccess
}
// compile only
@SuppressWarnings("unused")
public void demonstrateJoinSeedNodes() {
//#join-seed-nodes
final Cluster cluster = Cluster.get(system);
List<Address> list = new LinkedList<>(); //replace this with your method to dynamically get seed nodes
cluster.joinSeedNodes(list);
//#join-seed-nodes
}
}