Reputation: 11599
I have an actor called OrderActor which is the order being created for a customer. I have a validation rule that says If the Product is a computer, allow only one item. This rule should be applied whenever the OrderActor receives a message to add a product.
My question is about the Validation. Should I have a new actor called OrderValidatorActor and this needs to have the OrderActor as the parent actor? In this case, the flow of the events should be The OrderActor sends a message to the OrderValidatorActor which sends a response back to the OrderActor after validation.
Please guide on how to handle validation?
Upvotes: 2
Views: 357
Reputation: 11599
The role/responsibility based object oriented programming principle apply in actor modeling also. The responsibility of validation is thus done in the OrderValidatorActor.
Upvotes: 1
Reputation: 407
How about this?
Upvotes: 4