Parv Sharma
Parv Sharma

Reputation: 12705

Actor Pattern - How to model Room Booking Structure ?

I'am trying to model hotel room booking system in actor pattern. just for information i'am using akka.net for this in .Net.

For now i have created following actors. 1. HotelActorRoomsActor (An Aggregate of RoomActor)
3. BookingsActor (An Aggregate of BookingActor)
4. EmployeesActor (An aggregate of EmployeeActor)
4. UIActor

Currently as i have planned iam creating the system as follows.
1. UIActor Takes the BookingInformation (Checkin, Checkout, No of rooms)
2. Tell the BookingsActor about the information.
3. BookingsActor creates / starts a new BookingActor and passes on the information

4. On BookingActor Start it will
4a. Schedule Rooms for the Booking
4b. Tell the Rooms about the schedule so that they block themselves
4c. Schedule Employee Tasks for the rooms
4d. Tell the selected employees about their tasks
4e. Tell the system that the booking as been created
4f. Tell the BookingsActor to restart the BookingActor at some specific time in the future (24 hours before actual booking checkin) and shut down.


Problems im facing are
1. How to keep the UIActor in sync of the booking information
2. The UIActor Should also be able to Save information about multiple bookings (For a partiular customer etc) how and where should it be done inside an Actor Pattern?
3. Lets say i want the information about multiple bookings From Date1 to Date2 where should i persist this information to later retrieve it?

Upvotes: 1

Views: 346

Answers (1)

profesor79
profesor79

Reputation: 9473

ad 1. you can see example of sync dispatcher in akka bootcamp

and example source:

dispatcher = akka.actor.synchronized-dispatcher 
             #causes ChartingActor to run on the UI thread for WinForms

ad 2. the UI actor should only collect data from user and display results, all other actions need to be pushed down for processing to let say storage actor

ad 3. you need a storage provider - that can be mongoDB or SQL solution. Passing a message to storage actor you can persist reservation data or retrive when needed.

Upvotes: 0

Related Questions