I'm working on a dropwizard application. I have a resource, EmployeeResource, which triggers a mail api.
@Path("/employee")
public class EmployeeResource {
@GET
@Path("/list")
public void getEmployeeDetails(){
//DAO call and other stuff
mailClient.sendMail();
}
}
Now, sendMail method will fetch some details from DB, and then make a call to a mail API. I want the method sendMail to not block the "/employee/list" request. Is there a way to make the sendMail method async?
I looked it up and found solutions to make an API async, but I want just my sendMail method to be async. How do I solve this?
Edit: I'm not using Spring framework, just using Dropwizard framework.