actor

time-based simulation with actors model

我是研究僧i 提交于 2019-12-20 14:42:56
问题 we have a single threaded application that simulates the interaction of a hundred of thousands of objects over time with the shared memory model. obviously, it suffers from its inability to scale over multi CPU hardware. after reading a little about agent based modeling and functional programming/actor model I was considering a rewrite with the message-passing paradigm. the idea is very simple - each object will be an actor and their interactions will be messages so that the simulation could

Akka remote actor server discovery

匆匆过客 提交于 2019-12-20 14:10:06
问题 I would like to deploy a remote actors software made with akka on a cluster. The system is composed of several worker nodes and a single master node. The problem is that I cannot know in advance the IP address of the cluster nodes (but I know they are all part of the same subnetwork). So, I need a nice way of discovering the IP address of everyone after startup, to create the correct actor refs on each node. I am looking for a ligtweight solution (I just need it for the initial setup)

Simple Scala actor question

十年热恋 提交于 2019-12-20 13:34:33
问题 I'm sure this is a very simple question, but embarrassed to say I can't get my head around it: I have a list of values in Scala. I would like to use use actors to make some (external) calls with each value, in parallel. I would like to wait until all values have been processed, and then proceed. There's no shared values being modified. Could anyone advise? Thanks 回答1: There's an actor-using class in Scala that's made precisely for this kind of problem: Futures. This problem would be solved

Type safe Scala actors

回眸只為那壹抹淺笑 提交于 2019-12-20 12:24:21
问题 Is there any way to specify what type of message an actor can accept and give a compile error if anything tries to send it some other type? 回答1: Not sure whether it answers your question, but I hope it will give you some ideas. Maybe you are searching for something like Typed Actors from Akka project: The Typed Actors are implemented through Typed Actors. It uses AOP through AspectWerkz to turn regular POJOs into asynchronous non-blocking Actors with semantics of the Actor Model. E.g. each

Using Actors instead of `synchronized`

爷,独闯天下 提交于 2019-12-20 11:49:46
问题 Every time I read about using synchronized in Scala the author will usually mention that Actors should be used instead (this for example). While I understand roughly how actors work I'd really like to see an example of Actors being used to replace Java's synchronized method modifier (by this I mean its Scala equivalent - the synchronized block) in a piece of code. Modifying the internals of a data structure for instance would be nice to see. Is this a good use of Actors or have I been

Is passing around ActorRef to other Actors good or bad ?

微笑、不失礼 提交于 2019-12-20 11:11:06
问题 I'm trying to figure out if my usage of passing Akka ActorRef around to other actors is not an anti-pattern. I've a few actors in my system. Some are long lived ( restClientRouter , publisher ) and some die after that they have done the work ( geoActor ). The short-lived actors need to send messages to the long-lived actors and therefore need their ActorRef s. //router for a bunch of other actors val restClientRouter = createRouter(context.system) //publishers messages to an output message

How to test Akka Actor functionality by mocking one or more methods in it

妖精的绣舞 提交于 2019-12-20 10:48:34
问题 I'm interested to know about how to test Akka Actor functionality, by mocking some methods ( substitute real object's/actor's method implementation by mocked one ) in Actor. I use akka.testkit.TestActorRef ; Also: I tried to use SpyingProducer but it is not clear how to use it. (like I if I created actor inside its implementation it would be the same I have now). The google search result about that is not very verbose. I use powemockito and java . But It does not matter. I would be interested

What are the differences and useage patterns for dispatchers in Akka 2?

♀尐吖头ヾ 提交于 2019-12-20 10:36:11
问题 I've trouble understanding the differences and recommended usage of the dispatchers in Akka 2. I think I understand how the BalancingDispatcher and the CallingThreadDispatcher behave but I have no idea about the Dispatcher and PinnedDispatcher. I don't understand the concepts of Sharability and Bulkheading , either. 回答1: I believe Sharability refers to the number/type of actors that can share a particular type of dispatcher. I'm not sure on bulkheading, but I'm going to assume it refers to

Akka and ReactiveMongo

随声附和 提交于 2019-12-20 10:08:13
问题 I am trying to find the best approach to sharing the same pool of connection between actors withing the cluster workers. I have the following structure: Master Actor -> Worker Actors(can be up to 100 or more) -> MongoDB Between workers and MongoDB I want to put reactivemongo, however I am not sure how exactly to provide connection pool sharing between all actors. According to reactivemongo documentation: A MongoDriver instance manages an actor system; a connection manages a pool of

Akka Actors: Need an example to understand some basics

↘锁芯ラ 提交于 2019-12-20 09:02:36
问题 I'm tinkering with Akka and need some advice how to implement something specific i have in mind. I want to have an actor which i can send a DownloadFile(URI, File) message and downloads it. Since this can be paralleled, I don't want to download file after file but have a limit of concurrent downloads. Whats the intended way to model something like this with Akka? Other things that come to mind are: What happens if one of the "worker" actor dies for some reason? How to retry the download? Etc.