本文整理汇总了Java中akka.actor.ActorSystem.actorSelection方法的典型用法代码示例。如果您正苦于以下问题:Java ActorSystem.actorSelection方法的具体用法?Java ActorSystem.actorSelection怎么用?Java ActorSystem.actorSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akka.actor.ActorSystem
的用法示例。
在下文中一共展示了ActorSystem.actorSelection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnection
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static void createConnection() {
try{
ProjectLogger.log("ActorUtility createConnection method start....");
ActorSystem system =
ActorSystem.create("ActorApplication",ConfigFactory.load().getConfig("ActorConfig"));
String path = PropertiesCache.getInstance().getProperty("remote.actor.path");
try {
if (!ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ACTOR_IP))
&& !ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ACTOR_PORT))) {
ProjectLogger.log("value is taking from system env");
path = MessageFormat.format(
PropertiesCache.getInstance().getProperty("remote.actor.env.path"),
System.getenv(JsonKey.SUNBIRD_ACTOR_IP), System.getenv(JsonKey.SUNBIRD_ACTOR_PORT));
}
ProjectLogger.log("Actor path is ==" + path, LoggerEnum.INFO.name());
} catch (Exception e) {
ProjectLogger.log(e.getMessage(), e);
}
selection = system.actorSelection(path);
ProjectLogger.log("ActorUtility selection reference : "+selection);
}catch(Exception ex){
ProjectLogger.log("Exception Occurred while creating remote connection in ActorUtility createConnection method "+ex);
}
}
示例2: createActorContextMock
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
final ActorContext mock = mock(ActorContext.class);
final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
final ActorSelection selection = system.actorSelection(actor.path());
final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
promise.success(shardInfo);
when(mock.findPrimaryShardAsync(SHARD)).thenReturn(promise.future());
return mock;
}
示例3: createActorContextMock
import akka.actor.ActorSystem; //导入方法依赖的package包/类
protected static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
final ActorContext mock = mock(ActorContext.class);
final Promise<PrimaryShardInfo> promise = new DefaultPromise<>();
final ActorSelection selection = system.actorSelection(actor.path());
final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
promise.success(shardInfo);
when(mock.findPrimaryShardAsync(any())).thenReturn(promise.future());
return mock;
}
示例4: createActorContextMock
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
final ActorContext mock = mock(ActorContext.class);
final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
final ActorSelection selection = system.actorSelection(actor.path());
final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
promise.success(shardInfo);
when(mock.findPrimaryShardAsync(any())).thenReturn(promise.future());
return mock;
}
示例5: createActorContextMock
import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
final ActorContext mock = mock(ActorContext.class);
final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
final ActorSelection selection = system.actorSelection(actor.path());
final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
promise.success(shardInfo);
when(mock.findPrimaryShardAsync("default")).thenReturn(promise.future());
return mock;
}
示例6: createConnectionForBackgroundActors
import akka.actor.ActorSystem; //导入方法依赖的package包/类
public static void createConnectionForBackgroundActors() {
String path = PropertiesCache.getInstance().getProperty("background.remote.actor.path");
ActorSystem system = null;
String bkghost = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP);
String bkgport = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT);
Config con = null;
if ("local"
.equalsIgnoreCase(PropertiesCache.getInstance().getProperty("api_actor_provider"))) {
con = ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME);
system = akka.actor.ActorSystem.create(REMOTE_ACTOR_SYSTEM_NAME, con);
}else{
system = RequestRouterActor.getSystem();
}
try {
if (!ProjectUtil.isStringNullOREmpty(bkghost) && !ProjectUtil.isStringNullOREmpty(bkgport)) {
ProjectLogger.log("value is taking from system env");
path = MessageFormat.format(
PropertiesCache.getInstance().getProperty("background.remote.actor.env.path"),
System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP),
System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT));
}
ProjectLogger.log("Actor path is ==" + path, LoggerEnum.INFO.name());
} catch (Exception e) {
ProjectLogger.log(e.getMessage(), e);
}
selection = system.actorSelection(path);
ProjectLogger.log("ActorUtility selection reference : " + selection);
}