score:0

Just send a message from A to B when you have computed the data. After that, B can either switch to "verified" or to "unverified" state depending on verification results, and react on the subsequent messages depending on its state.

An example of how to handle the different states with extra information:

class MyDBActor extends Actor {
  def receive = starting
  def starting = {
    case data:DataFromA => 
        dbData = <load data from DB>
        if (<data is OK>)
           context.become(verified(dbData))
        else
           context.become(unverified)
  }
  def verified(dbData:DataFromDB) = {
    case whatevermessage => 
      < do something with message and data>
  }
  def unverified => {
    case _ => <throw exception, log unverified access, etc>
  }
}

Another option might be to use DB data in order to instantiate a new actor, which would be instantiated if and only the data is correct, and make other parts of program trying to talk to this actor. If the data is not verified, the actor would not exist (but you'll get to deal with exceptions somehow).


Related Query

More Query from same tag