本文整理匯總了Java中akka.actor.ActorSystem.create方法的典型用法代碼示例。如果您正苦於以下問題:Java ActorSystem.create方法的具體用法?Java ActorSystem.create怎麽用?Java ActorSystem.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類akka.actor.ActorSystem
的用法示例。
在下文中一共展示了ActorSystem.create方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import akka.actor.ActorSystem; //導入方法依賴的package包/類
public static void main(String[] args) {
final ActorSystem system = ActorSystem.create("KafkaProducerSystem");
final Materializer materializer = ActorMaterializer.create(system);
final ProducerSettings<byte[], String> producerSettings =
ProducerSettings
.create(system, new ByteArraySerializer(), new StringSerializer())
.withBootstrapServers("localhost:9092");
CompletionStage<Done> done =
Source.range(1, 100)
.map(n -> n.toString())
.map(elem ->
new ProducerRecord<byte[], String>(
"topic1-ts",
0,
Instant.now().getEpochSecond(),
null,
elem))
.runWith(Producer.plainSink(producerSettings), materializer);
done.whenComplete((d, ex) -> System.out.println("sent"));
}
示例2: setup
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setup() throws InterruptedException {
config1 = new RemoteRpcProviderConfig.Builder("memberA").build();
config2 = new RemoteRpcProviderConfig.Builder("memberB").build();
node1 = ActorSystem.create("opendaylight-rpc", config1.get());
node2 = ActorSystem.create("opendaylight-rpc", config2.get());
}
示例3: setUp
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setUp() {
hashTagId = String.valueOf(System.currentTimeMillis());
hashTagId2 = String.valueOf(System.currentTimeMillis())+45;
system = ActorSystem.create("system");
Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
batchDbInfo = Util.dbInfoMap.get(JsonKey.COURSE_BATCH_DB);
userOrgdbInfo = Util.dbInfoMap.get(JsonKey.USR_ORG_DB);
userOrgDB = Util.dbInfoMap.get(JsonKey.USR_ORG_DB);
userId = String.valueOf(System.currentTimeMillis());
usrOrgId = String.valueOf(System.currentTimeMillis());
}
示例4: main
import akka.actor.ActorSystem; //導入方法依賴的package包/類
public static void main(final String[] args) throws Exception {
final Map<String, String> opts = argsToOpts(Arrays.asList(args));
applySystemProperties(opts);
final String name = opts.getOrDefault("name", "coffee-house");
final ActorSystem system = ActorSystem.create(String.format("%s-system", name));
final CoffeeHouseApp coffeeHouseApp = new CoffeeHouseApp(system);
coffeeHouseApp.run();
}
示例5: startApp
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void startApp() {
app = Helpers.fakeApplication();
Helpers.start(app);
headerMap = new HashMap<String, String[]>();
headerMap.put(HeaderParam.X_Consumer_ID.getName(), new String[]{"Service test consumer"});
headerMap.put(HeaderParam.X_Device_ID.getName(), new String[]{"Some Device Id"});
headerMap.put(HeaderParam.X_Authenticated_Userid.getName(), new String[]{"Authenticated user id"});
headerMap.put(JsonKey.MESSAGE_ID, new String[]{"Unique Message id"});
system = ActorSystem.create("system");
ActorRef subject = system.actorOf(props);
BaseController.setActorRef(subject);
}
示例6: main
import akka.actor.ActorSystem; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
ActorSystem actorSystem = ActorSystem.create(CLUSTER_NAME);
actorSystem.actorOf(SimpleClusterListener.props());
final ActorMaterializer materializer = ActorMaterializer.create(actorSystem);
Cluster cluster = Cluster.get(actorSystem);
List<Address> addresses = Arrays.asList(System.getenv().get("SEED_NODES").split(","))
.stream()
.map(ip -> new Address("akka.tcp", CLUSTER_NAME, ip, 2551))
.collect(Collectors.toList());
cluster.joinSeedNodes(addresses);
}
示例7: setup
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setup() {
File file = new File("D:\\Users\\xl\\workspace\\FlayShooting\\conf\\application.conf");
Config cg = ConfigFactory.parseFile(file);
cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
Config config = ConfigFactory.load(cg).getConfig("CodeBroker");
system = ActorSystem.create("CodeBroker", config);
}
示例8: setUpClass
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setUpClass() throws IOException {
System.setProperty("shard.persistent", "false");
system = ActorSystem.create("test");
}
示例9: setupClass
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setupClass() throws IOException {
ACTOR_SYSTEM = ActorSystem.create("test");
}
示例10: setUp
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setUp() {
system = ActorSystem.create("system");
Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
}
示例11: setup
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setup() {
system = ActorSystem.create("BasketEntityTest");
}
示例12: main
import akka.actor.ActorSystem; //導入方法依賴的package包/類
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("akka-tracing");
ActorRef actorA = system.actorOf(Props.create(ActorA.class), "ActorA");
}
示例13: setup
import akka.actor.ActorSystem; //導入方法依賴的package包/類
@BeforeClass
public static void setup() throws InterruptedException {
system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
}
示例14: build
import akka.actor.ActorSystem; //導入方法依賴的package包/類
public MemberNode build() throws Exception {
Preconditions.checkNotNull(moduleShardsConfig, "moduleShardsConfig must be specified");
Preconditions.checkNotNull(akkaConfig, "akkaConfig must be specified");
Preconditions.checkNotNull(testName, "testName must be specified");
if (schemaContext == null) {
schemaContext = SchemaContextHelper.full();
}
MemberNode node = new MemberNode();
node.datastoreContextBuilder = datastoreContextBuilder;
Config baseConfig = ConfigFactory.load();
Config config;
if (useAkkaArtery) {
config = baseConfig.getConfig(akkaConfig);
} else {
config = baseConfig.getConfig(akkaConfig + "-without-artery")
.withFallback(baseConfig.getConfig(akkaConfig));
}
ActorSystem system = ActorSystem.create("cluster-test", config);
String member1Address = useAkkaArtery ? MEMBER_1_ADDRESS : MEMBER_1_ADDRESS.replace("akka", "akka.tcp");
Cluster.get(system).join(AddressFromURIString.parse(member1Address));
node.kit = new IntegrationTestKit(system, datastoreContextBuilder);
String memberName = new ClusterWrapperImpl(system).getCurrentMemberName().getName();
node.kit.getDatastoreContextBuilder().shardManagerPersistenceId("shard-manager-config-" + memberName);
node.configDataStore = node.kit.setupAbstractDataStore(DistributedDataStore.class,
"config_" + testName, moduleShardsConfig, true, schemaContext, waitForshardLeader);
if (createOperDatastore) {
node.kit.getDatastoreContextBuilder().shardManagerPersistenceId("shard-manager-oper-" + memberName);
node.operDataStore = node.kit.setupAbstractDataStore(DistributedDataStore.class,
"oper_" + testName, moduleShardsConfig, true, schemaContext, waitForshardLeader);
}
members.add(node);
return node;
}