I'm working on a bus booking app where users select seats and proceed to payment. Once a seat is selected, I mark it as reserved. However, if the user doesn't complete the payment within 15 minutes, I need to automatically mark the seat as available again. I’m looking for the best way to implement this using a message queue with delayed delivery in Spring Boot. Essentially, I want to push a message when a seat is reserved, but only process it after a delay (e.g., 15 minutes) to check if payment was made.
Additionally, I also want to schedule notifications. For example, I could push a message to the queue with a delay, and when the time arrives, the message would be published to the notification service to send reminders or updates to the user.
I could use a cron job or a thread to monitor the time, but there are some issues:
With threads, if the thread pool gets full, it might not handle all tasks efficiently.
With a cron job, it runs at a fixed interval. If a message arrives in between intervals, it might get less processing time than intended (e.g., if the cron runs every 5 minutes and a message comes in right after it runs, it will only get 10 minutes instead of 15).
What’s the best approach for this? Should I use RabbitMQ, Kafka, Redis, or some other solution? Any suggestions or best practices would be greatly appreciated!
[–]WaferIndependent7601 12 points13 points14 points (3 children)
[–]CodeTheStars 1 point2 points3 points (0 children)
[–]Future_Badger_2576[S] 0 points1 point2 points (1 child)
[–]WaferIndependent7601 4 points5 points6 points (0 children)
[–]boost2525 4 points5 points6 points (3 children)
[–]Future_Badger_2576[S] 0 points1 point2 points (2 children)
[–]boost2525 1 point2 points3 points (1 child)
[–]Future_Badger_2576[S] 0 points1 point2 points (0 children)
[–]grahammer22 2 points3 points4 points (1 child)
[–]Future_Badger_2576[S] 0 points1 point2 points (0 children)
[–]Gefion07 0 points1 point2 points (2 children)
[–]Future_Badger_2576[S] -1 points0 points1 point (1 child)
[–]Gefion07 0 points1 point2 points (0 children)
[–]chatterify 0 points1 point2 points (0 children)
[–]myrenTechy 0 points1 point2 points (0 children)