Short answer
Replace this line:
private def makeOperation(...): Receive = {
With this:
private def makeOperation(...): Unit = {
Result type of your expression operation match { ... }
is Unit
, since it's the result type of the last method (!
) in every brunch.
Details
Method makeOperation
is wrong named. What it really do is processing messages.
Actually you don't need this method at all - you could process messages in normal
like this:
val normal: Receive = {
case Outer(MainOp(otherInt), someInt, true)
if otherInt < someInt => root ! makeMessage(...)
case Outer(MainOp(otherInt), someInt, true)
if otherInt > someInt => ...
case Outer(MainOp(otherInt), someInt, true) => ...
case Outer(MainOp(otherInt), someInt, false)
if otherInt < someInt => ...
case Outer(MainOp(otherInt), someInt, false)
if otherInt > someInt => ...
case Outer(MainOp(otherInt), someInt, false) => ...
case Outer(OtherOp1(...), someInt, someBool) => ...
case Outer(OtherOp2(...), someInt, someBool) => ...
}
You'd need a method with result type Receive
only if you want to change actor's behavior for next message (and all messages after) like this:
context become createNewBehavior(params)
See these answers for examples:
Initializing an actor before being able to handle some other messages
How to properly use akka actors in scala
Is it possible to do that in Scala (without mutating the internal state of a class)?