I'm trying to use the new Akka Actor API. I want to pipe the result of a Future
to actor that invoked it. To do this, I'm using pipeToSelf
. However, I'm getting this error:
not enough arguments for method pipeToSelf: (future: java.util.concurrent.CompletionStage[Value], applyToResult: akka.japi.function.Function2[Value,Throwable,EmailActor.Command])Unit.
Any ideas on how to resolve this issue? It's resulting from this code snippet.
val emailResult: Future[Unit] = mailer(email)
context.pipeToSelf(emailResult) {
case Success(_) =>
EmailSuccess(replyTo)
case Failure(e) =>
SendFailed(replyTo)
}
Side Notes:
Command
You are most likely referencing akka.actor.typed.javadsl.ActorContext
and not akka.actor.typed.scaladsl.ActorContext
as you expect. Check your imports