In our last blog “Adding an Email Sending Functionality in Play using Scala” we explained how to include an Email sending functionality in a Play Scala Application. But the way in which we implemented it, made it a Blocking one i.e., application will wait until email has been sent.
In this blog we will explain, how to make the Email Sending functionality a Non-blocking one. By making it non-blocking, the application will not wait until email is sent & will move on to the next step.
To make this functionality a Non-Blocking one, just make following changes in the mailSendingApp we posted earlier:-
1) Import following packages in Application.scala file
2) Add following code to Application.scala file
Note – To download the App with changes just click here.
2 thoughts on “A Non-blocking “Email sending” functionality in Scala1 min read”
Reblogged this on Play!ng with Scala.
Note that this is not non-blocking, but simply asynchronous. Whichever thread ends up running the ‘sendEmail’ function still blocks.
Comments are closed.