本文整理汇总了Java中akka.cluster.client.ClusterClientReceptionist类的典型用法代码示例。如果您正苦于以下问题:Java ClusterClientReceptionist类的具体用法?Java ClusterClientReceptionist怎么用?Java ClusterClientReceptionist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClusterClientReceptionist类属于akka.cluster.client包,在下文中一共展示了ClusterClientReceptionist类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Master
import akka.cluster.client.ClusterClientReceptionist; //导入依赖的package包/类
public Master(FiniteDuration workTimeout, AgentConfig agentConfig) {
this.workTimeout = workTimeout;
this.agentConfig = agentConfig;
this.reportExecutor = getContext().watch(getContext().actorOf(Props.create(ReportExecutor.class, agentConfig), "report"));
ClusterClientReceptionist.get(getContext().system()).registerService(getSelf());
this.cleanupTask = getContext().system().scheduler().schedule(workTimeout.div(2), workTimeout.div(2), getSelf(), CleanupTick, getContext().dispatcher(), getSelf());
}
示例2: Master
import akka.cluster.client.ClusterClientReceptionist; //导入依赖的package包/类
public Master(FiniteDuration workTimeout) {
this.workTimeout = workTimeout;
ClusterClientReceptionist.get(getContext().system()).registerService(getSelf());
this.cleanupTask = getContext().system().scheduler().schedule(workTimeout.div(2), workTimeout.div(2), getSelf(), CleanupTick, getContext().dispatcher(), getSelf());
}
示例3: createClientActors
import akka.cluster.client.ClusterClientReceptionist; //导入依赖的package包/类
/**
* Create ClientActor for each region.
*/
private void createClientActors( ActorSystem system ) {
for ( String region : getSeedsByRegion().keySet() ) {
if ( currentRegion.equals( region )) {
logger.info( "Creating clientActor for region [{}]", region );
// Each clientActor needs to know path to ClusterSingletonProxy and region
clientActor = system.actorOf(
Props.create( ClientActor.class, routersByMessageType ), "clientActor" );
ClusterClientReceptionist.get(system).registerService( clientActor );
} else {
logger.info( "Creating clusterClient for region [{}]", region );
Set<ActorPath> seedPaths = new HashSet<>(20);
for ( String seed : getSeedsByRegion().get( region ) ) {
seedPaths.add( ActorPaths.fromString( seed + "/system/receptionist") );
}
ActorRef clusterClient = system.actorOf( ClusterClient.props(
ClusterClientSettings.create(system).withInitialContacts( seedPaths )), "client");
clusterClientsByRegion.put( region, clusterClient );
}
}
}