本文整理汇总了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;
}