Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with task queue?
    primarykey
    data
    text
    <p>I am working with google app engine task queue. Its my first time. I found a tutorial but having some problems. Following are two servlets i am using to check task queue: </p> <pre><code> public class GAEJSignupSubscriberServlet extends HttpServlet { private static final Logger _logger = Logger.getLogger(GAEJSignupSubscriberServlet.class.getName()); public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world"); String strCallResult = ""; resp.setContentType("text/plain"); try { String strEmailId = req.getParameter("emailid"); _logger.info("Got a Signup Subscriber Request for Email ID : " + strEmailId); // // PUT YOUR TASK CODE HERE // if(strEmailId.equals("mh")){ System.out.println("email-id" + strEmailId); } strCallResult = "SUCCESS: Subscriber Signup"; _logger.info(strCallResult); resp.getWriter().println(strCallResult); } catch (Exception ex) { strCallResult = "FAIL: Subscriber Signup : " + ex.getMessage(); _logger.info(strCallResult); resp.getWriter().println(strCallResult); } } @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } } </code></pre> <p>second servlet is:</p> <pre><code> public class GAEJCreateTaskServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { this.doPost(req, resp); } public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world"); String strCallResult = ""; resp.setContentType("text/plain"); try { //Extract out the To, Subject and Body of the Email to be sent String strEmailId = req.getParameter("emailid"); //Do validations here. Only basic ones i.e. cannot be null/empty if (strEmailId == null) throw new Exception("Email Id field cannot be empty."); //Trim the stuff strEmailId = strEmailId.trim(); if (strEmailId.length() == 0) throw new Exception("Email Id field cannot be empty."); //Queue queue = QueueFactory.getDefaultQueue(); Queue queue = QueueFactory.getQueue("subscription-queue"); queue.add(TaskOptions.Builder.withUrl("/gaejsignupsubscriber").param("emailid",strEmailId)); strCallResult = "Successfully created a Task in the Queue"; resp.getWriter().println(strCallResult); } catch (Exception ex) { strCallResult = "Fail: " + ex.getMessage(); resp.getWriter().println(strCallResult); } } @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } } </code></pre> <p>I am invoking GAEJCreateTaskServlet with this URL:</p> <pre><code> http://localhost:8080/gaejcreatetask?emailid=romin@rocketmail.com </code></pre> <p>now problem is when i invoke this url i see the output that task is created but in development console i can not see any task in the queue. If i remove doPost function from both servlets then i see the task in the queue but when i run it nothing happens and tasks remains there. Why is it happening so and how can i solve this problem. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload