本文整理匯總了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);
}