I have the following driver / main class encapsulating my Akka program:
And the following ChickenCluckDetector actor:
class ChickenCluckDetector extends UntypedActor { @Override void onReceive(Object message) { if(message instanceof Cluck) { Cluck cluck = message as Cluck
So, the problem is how to safely / correctly pass the Cluck message to FizzBuzz#onCluck(Cluck) , which lives outside the actors system? I could provide a FizzBuzz link to the ChickenCluckDetector like this:
class ChickenCluckDetector extends UntypedActor { FizzBuzz fizzBuzz @Override void onReceive(Object message) { if(message instanceof Cluck) { Cluck cluck = message as Cluck fizzBuzz.onCluck(cluck) } } }
But I feel this violates Akka’s best practices and can cause all kinds of concurrency issues, especially if there is only one FizzBuzz (which is) inactive / driver and ten thousand ChickenCluckDetector actors. Ideas?
java actor akka
smeeb
source share