package se.hiq.jee7demo.batch;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Properties;
/**
* Created by jonashe on 2014-05-03.
*/
@WebServlet("/batch")
public class BatchServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
JobOperator jo = BatchRuntime.getJobOperator();
long jid = jo.start("myJob", new Properties());
resp.getWriter().printf("Batch job with id %d started %n", jid);
resp.getWriter().flush();
}
}