I am writing a program that has to interact with a library that was implemented using Akka. In detail, this library exposes an Actor as endpoint.
As far as I know and as it is explained in the book Applied Akka Pattern, the best way to interact with an Actor system from the outside is using the Ask Pattern.
The library I have to use exposes an actor Main
that accepts a Create
message. In response to this message, it can respond with two different messages to the caller, CreateAck
and CreateNack(error)
.
The code I am using is more or less the following.
implicit val timeout = Timeout(5 seconds)
def create() = (mainActor ? Create).mapTo[???]
The problem is clearly that I do not know which kind of type I have to use in mapTo
function, instead of ???
.
Am I using the right approach? Is there any other useful pattern to access to an Actor System from an outside program that does not use Actors?