Am going to handle a CRON job module which will be a generic module, on the job execution time shall I push the events to a queue so let the respective module will pick and do the respective operation. My question is that whether different modules can listen to the same queue? Is the below approach is correct? else can someone suggest a proper way to build a generic CRON job module that can be used by all the modules
1 Answer
For ticket holding use case CRON job is a overkill, it would get complicated. For a seat there are only three states
ticket_blocked
ticket_booked
ticket_available
I recommend you just use the above three states in the database and play around it. Just put the start time of the ticket blocking when the ticket is blocked state.
User blocks the seat --- > ticket_state : blocked:0100 User did not book the seat at until expiry ---> Do nothing When another user tries to book the seat get the ticket state and check if the blocking time as expired or not if expired then allow the ticket to be blocked again if not then tell the user that the ticket is blocked.
So the principle is Just In Time calculation if the ticket is blocked or not.
Hope this helps.
