Akka with Java - Application Design Pattern - Request For Comments

I have recently joined an organization using Akka with Java for a major project. The organization is not rich in experience with Akka but has been using it for a year. I have been working on the project for 3 months.

We are proposing to implement the following pattern using Akka.

AkkaDesignPattern

Essentially we are looking to use Akka to provide thread safety and good concurrency. But we wish to separate the handling of business logic entirely from actors by placing all of it in delegates across a Task interface. The Task interface will correspond directly to the messages handled by the actor with a 1 to 1 mapping between messages the actor receives and methods on the interface. This interface will sit in front of the delegate and in front of the Actor thereby hiding the knowledge of messages sent between actors entirely. The Actor and delegate form a ‘Parent-Child’ relationship. Where the delegate needs to invoke Akka behavior it can do so by calling its ‘Parent’ across a Parent interface specifically for that purpose. The Actor inherits from ParentActor which implements the Parent interface. All classes in the system will follow this pattern and collaborate across these Task interfaces. The way we see it is that we have the flexibility to swap implementations of the Task interface and when new messages need to be implemented the act of adding a new method to the Task interface enforces the implementation of it in the delegate and the actor. We can also unit test the delegate completely independently of Akka.

Can anyone provide some concrete examples of issues that we might face in taking this approach. If you think it is unnecessarily complex are you able to express why and what a simpler/better relationship between Java and Akka would/should look like? Please reply to this question not just with an opinion but by including an example in words and or code of how you would do it differently in order to fully demonstrate the point you are making.

One simple concrete item to consider is that Akka has a nice TestKit that simplifies making your unit tests be Akka-based. Not sure how cutting Akka out of that testing makes your units test better? Seems like you would get better fidelity to real usage by making the tests message based.

We are looking to test with and without akka in order to validate the correctness of business logic on its own. Tests across the Task interface to an Actor will be integration tests. Here we might be testing the interaction of multiple Actors and TestProbes in performing a larger task.