Tag: akka

阿卡。 Android系统。 NoSuchMethodException:

当我在Android上运行使用Akka的应用程序时,我收到以下exception: 04-29 16:13:06.235: E/AndroidRuntime(8968): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.MyActivity}: java.lang.NoSuchMethodException: [interface com.typesafe.config.Config, interface akka.event.LoggingAdapter, interface java.util.concurrent.ThreadFactory] 在actor系统创建期间抛出此exception: Props props1 = Props.create(MyActor.class); ActorSystem system = ActorSystem.create(“MySystem”); 我假设proguard删除了一个构造函数,所以我将以下行添加到我的proguard.cfg中: -keep class com.typesafe.** { *; } 但它没有帮助。 我究竟做错了什么?

使用guice注入与actor抛出空指针

我在服务器的字段注入上获得空指针exception,该服务器作为akka actor启动。 计划部分: private ActorRef myActor = Akka.system().actorOf( new Props(Retreiver.class)); @Override public void onStart(Application app) { log.info(“Starting schedular…..!”); Akka.system() .scheduler() .schedule(Duration.create(0, TimeUnit.MILLISECONDS), Duration.create(30, TimeUnit.MINUTES), myActor, “tick”, Akka.system().dispatcher()); } Retreiver类部分: public class Retreiver extends UntypedActor { private Logger.ALogger log = Logger.of(Retreiver .class); @Inject private myDataService dataService; @Override public void onReceive(Object arg0) throws Exception { if (0 […]

为什么akka的spring integration doc仅存在于1.3.1但不存在于下一版本

关于整合AKKA和Spring的方式有一个链接。 或者更好地说:“如何在spring环境中使用Akka演员”。 http://doc.akka.io/docs/akka-modules/1.3.1/modules/spring.html 实际上只有1.3.1版本存在modules文件夹http://doc.akka.io/docs/akka-modules/ 。 Does it mean that there is no integration for different than `1.3.1` version with spring? Or it means that we should not use it (spring integration I mean)? Or we should do it in the same way as we do it for `1.3.1` version?

获得现有或创建新的akka​​演员

我正在尝试使用ActorFor获取现有的ActorRef,或者如果它不存在则创建一个新的ActorRef。 我有以下代码,但它似乎没有按预期工作。 .isTerminated()始终为true。 ActorSystem system = ActorSystem.create(“System”); ActorRef subscriberCandidate = system.actorFor(“akka://System/user/”+name); if (subscriberCandidate.isTerminated()) { ActorRef subscriber = system.actorOf(new Props(new UntypedActorFactory() { public UntypedActor create() { return new Sub(name,link); } }), name); System.out.println(subscriber.path().toString() + ” created”); } else System.out.println(“already exists”); 我在这里想念的是什么? 提前致谢。

知道akka演员存在的三种方法

我正在研究akka演员(JAVA),最近才知道有3种方式(可能更多)知道演员的存在。 发送识别消息 : ActorSelection sel = actorSystem.actorSelection(“akka://test/user/TestActor”); AskableActorSelection asker = new AskableActorSelection(sel); Future future = asker.ask(new Identify(1), new Timeout(5, TimeUnit.SECONDS)); ActorIdentity identity = (ActorIdentity) Await.result(future, timeOut.duration()); ActorRef reference = identity.getRef(); if(reference != null){ // Actor exists } else { // Actor does not exits } resolveOne方法 : ActorSelection sel = actorSystem.actorSelection(“akka://test/user/TestActor”); Future future = sel.resolveOne(new […]

Akka:如何查找集群中的当前节点?

从Akka演员那里,你怎么能找到集群的节点? 也就是说,本地节点认为当前可访问的节点。 谢谢, – 丹尼尔

我怎样才能检查Akka演员是否存在(akka 2.2)?

我有一个java对象,它不是一个使用actorSelection(Path)从actor系统中选择actor的actor。 系统中可能存在所选的actor。 在Java Api中,ActorSelection不存在ask(),因此我无法向actor选择发送和Identify消息并使用响应的发送者。 我试图通过演员选择向演员发送消息然后对deadletter做出反应来解决问题。 但我没有任何动静。 如果演员活着还是不存在,我如何检查ActorSelection? ActorSystem system = ActorSystem.create(“test”); //create test actor system.actorOf(Props.create(TestActor.class), “testActor”); //add dead letter listener to the system ActorRef eventBusActor = asys.actorOf(Props.create(EventBusActor.class), “eventbusactor”); system.eventStream().subscribe(eventBusActor, DeadLetter.class); //This works. The test actor receives the message ActorSelection a1 = asys.actorSelection(“/user/testActor”); a1.tell(“hello”, ActorRef.noSender()); //This does not work and does not send dead letters ActorSelection […]

正确的设计在阿卡。 – 消息传递

我已经阅读了一些关于akka如何以及为何不保证邮件传递的post。 文档 ,本次讨论和关于小组的其他讨论确实很好地解释了它。 我对akka很新,并希望知道一个案例的合适设计。 例如,假设我在不同的机器上有3个不同的演员。 一个是烹饪书籍,另一个是历史,最后一个是技术书籍。 我在另一台机器上有一个主演员。 假设有一个查询主要参与者搜索我们是否有一本书可用。 主actor向3个远程actor发送请求,并期望结果。 所以我这样做: val scatter = system.actorOf( Props[SearchActor].withRouter(ScatterGatherFirstCompletedRouter( routees=someRoutees, within = 10 seconds)), “router”) implicit val timeout = Timeout(10 seconds) val futureResult = scatter ? Text(“Concurrency in Practice”) // What should I do here?. //val result = Await.result(futureResult, timeout.duration) line(a) 简而言之,我已经向所有3个远程演员发送了请求,并期望在10秒内得到结果。 应该采取什么行动? 假设我在10秒钟内没有得到结果,我是否应该再次向所有人发送新请求? 如果within上述时间within是不成熟的。 但我不知道预先花了多少时间。 如果within时间足够但信息被删除了怎么办? 如果我没有within时间within得到回复并再次重新发送请求。 像这样的东西,它仍然是异步的: […]

如何从Java中的Java List创建scala.collection.immutable.Seq?

我正试图让Akka进入我的Java项目,并且我在Scala的Seq类型上遇到了一个小问题。 我能够将我的ActorRef的Java List转换为scala.collection.Seq,但我尝试使用的Akka API需要一个scala.collection.immutable.Seq。 我该怎么做? 码: static class Router extends UntypedLoadBalancer { private final InfiniteIterator workers; public Router(List workers) { Seq workerSeq = asScalaBuffer(workers); // how to get from the scala.collection.Seq above to the instance of // scala.collection.immutable.Seq required by CyclicIterator below? this.workers = new CyclicIterator(); } public InfiniteIterator seq() { return workers; } }

如何正确调用Akka HTTP客户端多个(10k – 100k)请求?

我正在尝试使用Akka HTTP 2.0-M2编写批量数据上传工具。 但是我面临akka.stream.OverflowStrategy$Fail$BufferOverflowException: Exceeded configured max-open-requests value of [32] error. 我试图隔离一个问题,这里的示例代码也失败了: public class TestMaxRequests { private static final class Router extends HttpApp { @Override public Route createRoute() { return route( path(“test”).route( get(handleWith(ctx -> ctx.complete(“OK”))) ) ); } } public static void main(String[] args) { ActorSystem actorSystem = ActorSystem.create(); Materializer materializer = ActorMaterializer.create(actorSystem); Router router […]