本文整理了Java中akka.actor.Props
类的一些代码示例,展示了Props
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Props
类的具体详情如下:
包路径:akka.actor.Props
类名称:Props
暂无
代码示例来源:origin: apache/flink
protected ActorRef createSelfActor() {
return actorSystem.actorOf(
Props.create(AkkaAdapter.class, this),
"ResourceManager");
}
代码示例来源:origin: kaaproject/kaa
private ActorRef getOrCreateTenantActorByTokenId(String tenantId) {
ActorRef tenantActor = tenants.get(tenantId);
if (tenantActor == null) {
tenantActor = context().actorOf(
Props.create(new TenantActor.ActorCreator(context, tenantId))
.withDispatcher(CORE_DISPATCHER_NAME), tenantId);
tenants.put(tenantId, tenantActor);
}
return tenantActor;
}
代码示例来源:origin: stackoverflow.com
ActorRef child = this.getContext().actorOf(new Props(MyGeneratorChildWorker.class));
child.tell(new ConfigMessage("doSomething!"));
child.tell(akka.actor.PoisonPill.getInstance());//kill the child after the work is complete...
代码示例来源:origin: kaaproject/kaa
private ActorRef getOrCreateLogActor(String name) {
ActorRef logActor = logsSessions.get(name);
if (logActor == null) {
logActor = context().actorOf(
Props.create(new ApplicationLogActor.ActorCreator(context, appToken))
.withDispatcher(LOG_DISPATCHER_NAME)
);
context().watch(logActor);
logsSessions.put(logActor.path().name(), logActor);
}
return logActor;
}
代码示例来源:origin: kaaproject/kaa
/**
* Inits the actor system.
*/
@PostConstruct
public void initActorSystem() {
LOG.info("Initializing Akka system...");
akka = ActorSystem.create(EPS, context.getConfig());
LOG.info("Initializing Akka EPS actor...");
opsActor = akka.actorOf(Props.create(
new OperationsServerActor.ActorCreator(context))
.withDispatcher(CORE_DISPATCHER_NAME), EPS);
LOG.info("Lookup platform protocols");
Set<String> platformProtocols = PlatformLookup.lookupPlatformProtocols(
PlatformLookup.DEFAULT_PROTOCOL_LOOKUP_PACKAGE_NAME);
LOG.info("Initializing Akka io router...");
ioRouter = akka.actorOf(
new RoundRobinPool(context.getIoWorkerCount())
.withSupervisorStrategy(SupervisionStrategyFactory.createIoRouterStrategy(context))
.props(Props.create(new EncDecActor.ActorCreator(opsActor, context, platformProtocols))
.withDispatcher(IO_DISPATCHER_NAME)), IO_ROUTER_ACTOR_NAME);
LOG.info("Initializing Akka event service listener...");
eventListener = new AkkaEventServiceListener(opsActor);
context.getEventService().addListener(eventListener);
clusterListener = new AkkaClusterServiceListener(opsActor);
context.getClusterService().setListener(clusterListener);
LOG.info("Initializing Akka system done");
}
代码示例来源:origin: baekjunlim/AkkaStarting
public static void main(String[] args) {
ActorSystem actorSystem = ActorSystem.create("TestSystem");
ActorRef ping = actorSystem.actorOf(Props.create(PingActor.class), "pingActor");
ping.tell("bad", ActorRef.noSender());
}
代码示例来源:origin: fhopf/akka-crawler-example
@Override
public void downloadAndIndex(final String path, final IndexWriter writer) {
ActorSystem actorSystem = ActorSystem.create();
ActorRef master = actorSystem.actorOf(Props.create(SimpleActorMaster.class, new HtmlParserPageRetriever(path), writer));
master.tell(path, actorSystem.guardian());
actorSystem.awaitTermination();
}
代码示例来源:origin: wxyyxc1992/Backend-Boilerplates
public static void main(String... args) throws Exception {
final ActorSystem system = ActorSystem.create("example");
final ActorRef persistentActor = system.actorOf(Props.create(ExamplePersistentActor.class), "persistentActor-3-java");
persistentActor.tell("a", null);
persistentActor.tell("b", null);
persistentActor.tell("snap", null);
persistentActor.tell("c", null);
persistentActor.tell("d", null);
persistentActor.tell("print", null);
Thread.sleep(10000);
system.terminate();
}
}
代码示例来源:origin: apache/flink
Configuration flinkConfig = new Configuration();
YarnConfiguration yarnConfig = new YarnConfiguration();
SettableLeaderRetrievalService leaderRetrievalService = new SettableLeaderRetrievalService(
leader1 = system.actorOf(
Props.create(
TestingUtils.ForwardingActor.class,
getRef(),
));
resourceManager = system.actorOf(
Props.create(
TestingYarnFlinkResourceManager.class,
flinkConfig,
));
leaderRetrievalService.notifyListener(leader1.path().toString(), leaderSessionID);
leaderRetrievalService.notifyListener(leader1.path().toString(), leaderSessionID);
} finally {
if (resourceManager != null) {
resourceManager.tell(PoisonPill.getInstance(), ActorRef.noSender());
代码示例来源:origin: apache/flink
LOG.debug("keytabPath: {}", keytabPath);
config.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, keytabPath);
config.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL, remoteKeytabPrincipal);
final String amPortRange = config.getString(
YarnConfigOptions.APPLICATION_MASTER_PORT);
LOG);
ActorRef resourceMaster = actorSystem.actorOf(resourceMasterProps);
actorSystem.actorOf(
Props.create(ProcessReaper.class, resourceMaster, LOG, ACTOR_DIED_EXIT_CODE),
"YARN_Resource_Master_Process_Reaper");
actorSystem.actorOf(
Props.create(ProcessReaper.class, jobManager, LOG, ACTOR_DIED_EXIT_CODE),
"JobManager_Process_Reaper");
代码示例来源:origin: write2munish/Akka-Essentials
public static void main(String[] args) throws Exception {
ActorSystem _system = ActorSystem.create("BecomeUnbecome");
ActorRef pingPongActor = _system
.actorOf(new Props(PingPongActor.class));
pingPongActor.tell(PingPongActor.PING, pingPongActor);
Thread.sleep(2000);
_system.shutdown();
}
代码示例来源:origin: apache/usergrid
if ( !request.isOnlyIfEmpty() || inMemoryQueue.peek( request.getQueueName()) == null ) {
ActorRef readerRef = getContext().actorOf(
Props.create( GuiceActorProducer.class, QueueRefresher.class ),
request.getQueueName() + "_reader");
queueReadersByQueueName.put( request.getQueueName(), readerRef );
queueReadersByQueueName.get( request.getQueueName() ).tell( request, self() );
Props.create( GuiceActorProducer.class, QueueTimeouter.class),
request.getQueueName() + "_timeouter");
queueTimeoutersByQueueName.put( request.getQueueName(), readerRef );
queueTimeoutersByQueueName.get( request.getQueueName() ).tell( request, self() );
Props.create( GuiceActorProducer.class, ShardAllocator.class),
request.getQueueName() + "_shard_allocator");
shardAllocatorsByQueueName.put( request.getQueueName(), readerRef );
shardAllocatorsByQueueName.get( request.getQueueName() ).tell( request, self() );
代码示例来源:origin: eBay/parallec
getSender().tell(new ResponseFromManager(requestCount),
getSelf());
logger.info("req count <=0. return");
+ " at " + prepareRequestTimeStr);
ActorRef worker = getContext().system().actorOf(
Props.create(OperationWorker.class,
new TaskRequest(task.getConfig()
.getActorMaxOperationTimeoutSec(),
maxConcurrency);
batchSenderAsstManager = getContext().system().actorOf(
Props.create(AssistantExecutionManager.class),
"RequestToBatchSenderAsstManager-"
+ UUID.randomUUID().toString());
batchSenderAsstManager.tell(requestToBatchSenderAsstManager,
getSelf());
this.responseCount);
batchSenderAsstManager.tell(
responseCountToBatchSenderAsstManager, getSelf());
代码示例来源:origin: kaaproject/kaa
private void processEndpointRouteMessage(EndpointRouteMessage msg) {
EndpointObjectHash endpointKey = msg.getAddress().getEndpointKey();
GlobalEndpointActorMetaData actorMetaData = globalEndpointSessions.get(endpointKey);
if (actorMetaData == null) {
String endpointActorId = GlobalEndpointActorCreator.generateActorKey();
LOG.debug("[{}] Creating global endpoint actor for endpointKey: {}", appToken, endpointKey);
actorMetaData = new GlobalEndpointActorMetaData(
context().actorOf(Props.create(
new GlobalEndpointActorCreator(context, endpointActorId, appToken, endpointKey))
.withDispatcher(ENDPOINT_DISPATCHER_NAME), endpointActorId),
endpointActorId);
globalEndpointSessions.put(endpointKey, actorMetaData);
context().watch(actorMetaData.actorRef);
}
actorMetaData.actorRef.tell(msg, self());
}
代码示例来源:origin: apache/flink
final Configuration configuration = new Configuration();
final TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServices();
final ActorSystem actorSystem = AkkaUtils.createDefaultActorSystem();
actorRef = actorSystem.actorOf(
Props.create(
JobClientActorTest.PlainActor.class,
leaderId));
actorSystem.shutdown();
代码示例来源:origin: ajmalbabu/distributed-computing
public ActorRef actorOf(ActorSystem actorSystem, String actorSpringBeanName, RouterConfig routerConfig, String dispatcher, Parameters actorParameters) {
return actorSystem.actorOf(get(actorSystem).props(actorSpringBeanName, actorParameters).withRouter(routerConfig).withDispatcher(dispatcher));
}
代码示例来源:origin: baekjunlim/AkkaStarting
/** 웹서버 역할을 하는 HttpActor와 라우터를 생성한다 */
public static void main(String[] args) {
ActorSystem actorSystem = ActorSystem.create("ClusterSystem");
ActorRef router = actorSystem.actorOf(Props.create(PingService.class).withRouter(new FromConfig()), "serviceRouter");
ActorRef httpActor = actorSystem.actorOf(Props.create(HttpActor.class, router), "httpActor");
}
}
代码示例来源:origin: org.restcomm/restcomm-connect.http
private ActorRef session(final Configuration configuration) {
final Props props = new Props(new UntypedActorFactory() {
private static final long serialVersionUID = 1L;
@Override
public Actor create() throws Exception {
return new EmailService(configuration);
}
});
return system.actorOf(props);
}
代码示例来源:origin: jaibeermalik/searchanalytics-bigdata
public SetupIndexWorkerActor(final SetupIndexService setupIndexService,
final SampleDataGeneratorService sampleDataGeneratorService,
final IndexProductDataService indexProductDataService) {
this.setupIndexService = setupIndexService;
workerRouter = getContext().actorOf(
Props.create(SetupDocumentTypeWorkerActor.class,
sampleDataGeneratorService, indexProductDataService)
.withDispatcher(
"setupDocumentTypeWorkerActorDispatcher")
.withRouter(new FromConfig()),
"setupDocumentTypeWorkerActor");
}
代码示例来源:origin: henrikengstrom/akka-kata-java
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("BettingProcessorActorSystem", ConfigFactory.load());
ActorRef bettingProcessor = system.actorOf(new Props(BettingProcessor.class), "bettingProcessor");
}
}
内容来源于网络,如有侵权,请联系作者删除!