Asynchronous Event Handling

When implementing the notification feature for creating a new room, which sends notifications to users with matching tags and zones, I realized it should not interfere with the core room creation logic. If the notification process throws errors, it could cause the room creation to roll back. To prevent this, I decided to use @Async to handle notifications asynchronously.

<Service>

<To Handle Events>

However, there was one problem left. The basic @EnableAsync uses SimpleAsyncTaskExecutor so, it creates a new Thread for each task.

To prevent it, I override getAsuncExecutor() by implementing AsyncConfigurer.














Comments

Popular posts from this blog

@ModelAttribute vs @RequestBody in Validation

Side Project(a self-imposed 3-day "Hackathon" challenge)

Google: The King is Back