當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。