I have a method getAggOutput() that returns a HashMap, in Actor A.
def getAggOutput: HashMap[X, List[Y]] = {
println("***** Inside getAggOutput, rMap is: " + rMap)
return rMap
}
Also, in Actor A, the method is called that under the case object GETOUTPUT:
case GETOUTPUT =>
println("***** Inside GETOUTPUT")
getAggOutput
In Actor B, I am doing the following:
implicit val timeout = Timeout(5 seconds)
val reducerInput = sender ? GETOUTPUT
val result = Await.result(reducerInput, timeout.duration)
println("****** RESULT is: " + result)
The print statements show that the value for rMap is correct, however, I am getting the following error:
java.util.concurrent.TimeoutException: Futures timed out after [5 seconds]
And result is not assigned the value of the HashMap.
How do I make this work? Or, is there a better way entirely? I just need to get rMap into Actor B
UPDATE:
I figured out this part. In the case GETOUTPUT, I need:
sender ! getAggOutput.
The println shows that the HashMap in the result variable is correct.
Now, I am trying to loop over the HashMap:
for( (key,value) <- result)
{
redOut += (key -> value)
}
And I am getting the following error:
type mismatch;
[error] found : (Any, Any)
[error] required: (X, U)
[error] redOut += (key -> value)
UPDATE:
I also tried:
for( (key,value) <- result)
{
redOut += (key.asInstanceOf[X] -> value.asInstanceOf[U])
}
However, I received the following error:
value withFilter is not a member of Any
[error] for( (key,value) <- result)