0
나는이 코드 조각이 :요구 사항을 보낸 사람에게 예외 예외를 다시 보내는 방법?
override def create(policy: Policy): Future[Policy] = {
//require that an id has not been assigned to this policy
if (policy.id != None) {
//ugly and does not type check, but trying to convey the general idea
sender ! require(policy.id == None)
require(policy.id == None)
else {
Future {
policy //dummy code for simplicity sake
}
}
}
내가 요구 사항이 충족되지 않은 보낸 사람에게 다시 메시지를 보내 싶습니다
. 가능한 한 가장 관용적 인 방식으로 시도하고 싶습니다. 이 액터에서 실행을 이상적으로 종료하고이 액터의 발신자에게 요구 메시지를 다시 보내고 싶습니다.
가장 좋은 방법은 무엇입니까?