so I am thinking of using the actor model to solve a problem I currently have. For brevity, I have made up a scenario so we don't get too technical.
Lets say I have 3 benches but each bench supports a different amount of people:
- Park Bench 1 supports 3 people simultaneously
- Park Bench 2 supports 5 people simultaneously
- Park Bench 3 supports 2 people simultaneously
Upfront I know which bench to route too however, what I don't have context of is how many people are sitting on the bench. What I want to do is block any further people from sitting on a bench if its full but when a seat becomes available allow them to sit on it.
For some reason, the Actor model popped into my head but I am not sure whether this is the correct approach and perhaps there is alternative approach to solving my problem in which case I am keen to hear.
I envision creating 3 actors
ParkBench3Actor and somehow control the number of live actors. I believe concepts such as pooling can help in these scenarios http://getakka.net/articles/actors/routers.html#pools-vs-groups.
Would appreciate peoples thoughts on this and tell me whether I have lost the plot a little :)