|
Akka/Scala example source code file (CalculatorActor.scala)
The CalculatorActor.scala Akka example source codepackage sample.remote.calculator import akka.actor.Props import akka.actor.Actor class CalculatorActor extends Actor { def receive = { case Add(n1, n2) => println("Calculating %d + %d".format(n1, n2)) sender() ! AddResult(n1, n2, n1 + n2) case Subtract(n1, n2) => println("Calculating %d - %d".format(n1, n2)) sender() ! SubtractResult(n1, n2, n1 - n2) case Multiply(n1, n2) => println("Calculating %d * %d".format(n1, n2)) sender() ! MultiplicationResult(n1, n2, n1 * n2) case Divide(n1, n2) => println("Calculating %.0f / %d".format(n1, n2)) sender() ! DivisionResult(n1, n2, n1 / n2) } } Other Akka source code examplesHere is a short list of links related to this Akka CalculatorActor.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.