In dropwizard, I need to implement asynchronous jobs and poll their status. I have 2 endpoints for this in resource:
@Path("/jobs")
@Component
public class MyController {
@POST
@Produces(MediaType.APPLICATION_JSON)
public String startJob(@Valid MyRequest request) {
return 1111;
}
@GET
@Path("/{jobId}")
@Produces(MediaType.APPLICATION_JSON)
public JobStatus getJobStatus(@PathParam("id") String jobId) {
return JobStatus.READY;
}
}
I am considering to use quartz to start job, but only single time and without repeating. And when requesting status, I will get trigger status. But the idea of using quartz for none-scheduled usage looks weird. Is there any better approaches for this? Maybe dropwizard provides better tools itself? Will appriciate any advices.
UPDATE: I also looking at https://github.com/gresrun/jesque, but can not find any way to poll the status of running job.