Grokking Spring Boot
0% completed
Asynchronous Methods
How long should Ana wait for an email that she will read a minute later?
In the booking service as it stands, she waits for all of it. POST /bookings charges her card, saves the booking, and then calls the Notifier, which hands the confirmation to a mail server. In our harness the mail server takes about 800 ms to accept a message, so a booking request took 0.84 seconds by curl's clock. After one change described below, the same request took 0.024 seconds, and the email still arrived.
The change moves the email onto another thread
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%