Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Created December 18, 2018 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/89ebae09893c12a425d4d665ca84c29e to your computer and use it in GitHub Desktop.
Save abhirockzz/89ebae09893c12a425d4d665ca84c29e to your computer and use it in GitHub Desktop.
@Path("tweets/producer")
public class ServiceManagerResource {
@GET
public Response start() {
Response r = null;
try {
ServiceLifecycleManager.getInstance().start();
r = Response.ok("Tweets Producer started. Tracking - "+ ServiceLifecycleManager.TRACKED_TERMS)
.build();
} catch (Exception ex) {
Logger.getLogger(ServiceManagerResource.class.getName()).log(Level.SEVERE, null, ex);
r = Response.serverError().build();
}
return r;
}
@DELETE
public Response stop() {
Response r = null;
try {
ServiceLifecycleManager.getInstance().stop();
r = Response.ok("Tweets Producer stopped")
.build();
} catch (Exception ex) {
Logger.getLogger(ServiceManagerResource.class.getName()).log(Level.SEVERE, null, ex);
r = Response.serverError().build();
}
return r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment