Parking Space Reservation Overlap


I would like to ask for a solution for a problem where in case a two customer search a parking space reservation in same time and same parking space it should return an error for both of them. 

Hi Gerald,

You cannot easily produce an error for both: the problem here is that you have less resources than consumers, but you don't know while handling each consumer whether there are other consumers also being handled. (Also, functionally this is strange, why would you want both customers to leave, still having an empty parking space?)

The solution to this could be to use a lock by means of the GetForUpdate Entity Action, and only after releasing the lock checking for availability. The second customer then is put "on hold" until the lock is released (which should take only a short while), then finds there is no more space.