Package com.google.appengine.api.labs.taskqueue

Examples of com.google.appengine.api.labs.taskqueue.TaskOptions


     *            ignored.
     * @return a newly created {@link TaskOptions} instance containing data from
     *         <code>exchange</code>.
     */
    public TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, TaskOptions request) {
        TaskOptions answer = TaskOptions.Builder.url(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here


        }
    }

  @Override
  public void generateReport(String address) {
    TaskOptions task = method(Method.GET).param("to", address);//(8)
    QueueFactory.getDefaultQueue().add(task); //(9)
  }
View Full Code Here

   
    private void retry(String token, String collapseKey,
            Map<String, String[]> params, boolean delayWhileIdle) {
        Queue dmQueue = QueueFactory.getQueue("c2dm");
        try {
            TaskOptions url =
                TaskOptions.Builder.url(C2DMRetryServlet.URI)
                .param(C2DMessaging.PARAM_REGISTRATION_ID, token)
                .param(C2DMessaging.PARAM_COLLAPSE_KEY, collapseKey);
            if (delayWhileIdle) {
                url.param(PARAM_DELAY_WHILE_IDLE, "1");
            }
            for (String key: params.keySet()) {
                String[] values = (String[]) params.get(key);
                url.param(key, URLEncoder.encode(values[0], UTF8));
            }
           
            // Task queue implements the exponential backoff
            long jitter = (int) Math.random() * C2DM_MAX_JITTER_MSEC;
            url.countdownMillis(jitter);
           
            TaskHandle add = dmQueue.add(url);
        } catch (UnsupportedEncodingException e) {
            // Ignore - UTF8 should be supported
            log.log(Level.SEVERE, "Unexpected error", e);
View Full Code Here

        res = mg.migrate_up(cursor, range, params);
        cursor = res.get("cursor");
      }
      if (cursor != null) {
        Queue queue = QueueFactory.getDefaultQueue();
        TaskOptions topt = TaskOptions.Builder.url("/migration");
        for (String rkey : res.keySet()) {
          if (!rkey.equals("cursor")) {
            topt = topt.param(rkey, ""+ res.get(rkey));
          }
        }
        queue.add(topt.param("cursor", cursor).param("num", ""+range).
          param("dir", direction).param("migration", migration));
      }
    }
    catch (ClassNotFoundException e) {
      // e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.google.appengine.api.labs.taskqueue.TaskOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.