当前位置: 首页>>代码示例>>Java>>正文


Java ActorSystem.create方法代码示例

本文整理汇总了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"));
}
 
开发者ID:jeqo,项目名称:talk-kafka-messaging-logs,代码行数:25,代码来源:KafkaProducer.java

示例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());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:AbstractRpcTest.java

示例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());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:13,代码来源:CourseBatchManagementActorTest.java

示例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();
}
 
开发者ID:ironfish,项目名称:oreilly-reactive-with-akka,代码行数:10,代码来源:CoffeeHouseApp.java

示例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);
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:15,代码来源:AuditLogControllerTest.java

示例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);
}
 
开发者ID:saturnism,项目名称:akka-kubernetes-example,代码行数:13,代码来源:SimpleClusterMain.java

示例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);
}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:9,代码来源:CodeBrokerTest.java

示例8: setUpClass

import akka.actor.ActorSystem; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() throws IOException {
    System.setProperty("shard.persistent", "false");
    system = ActorSystem.create("test");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:AbstractActorTest.java

示例9: setupClass

import akka.actor.ActorSystem; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() throws IOException {
    ACTOR_SYSTEM = ActorSystem.create("test");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:AbstractMessagingTest.java

示例10: setUp

import akka.actor.ActorSystem; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
    system = ActorSystem.create("system");
    Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:6,代码来源:CourseSearchActorTest.java

示例11: setup

import akka.actor.ActorSystem; //导入方法依赖的package包/类
@BeforeClass
public static void setup() {
    system = ActorSystem.create("BasketEntityTest");
}
 
开发者ID:ignasi35,项目名称:lagom-java-workshop,代码行数:5,代码来源:InventoryEntityTest.java

示例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");

}
 
开发者ID:tuhingupta,项目名称:akka-sample-tracing-java,代码行数:6,代码来源:Main.java

示例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"));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:LatestEntryRoutingLogicTest.java

示例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;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:42,代码来源:MemberNode.java


注:本文中的akka.actor.ActorSystem.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。