Example of how to convert a synchronous blocking REST endpoint into a non-blocking endpoint
Request to start the job execution asynchronously and returns immediately with a job started response
POST Request -> http://localhost:8080/threadjobs/async
Request Body -> {"jobId":5}
Response Status -> 200
Response Message -> Job started for id :: 5
Response Status -> 200
Response Message -> Already Processing job with id: 5
Returns the job status unless it has finished in which case it returns the result
GET Request -> http://localhost:8080/threadjobs/5
Response Status -> 200
Response Message -> Started
Response Status -> 200
Response Message -> Job with id: 5 finished with result = 10
Response Status -> 200
Response Message -> Job with id: 5 not found