Package com.google.appengine.api.taskqueue

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


    }
   
    @Test
    public void testWriteRequestBody() {
        exchange.getIn().setBody("test");
        TaskOptions options = withDefaults();
        binding.writeRequestBody(endpoint, exchange, options);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("test", info.getBody());
        assertNull("application/octet-stream", getHeader(info , Exchange.CONTENT_TYPE));
View Full Code Here


    }
   
    @Test
    public void testWriteRequestWithDefaultWorkerRoot() throws Exception {
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(endpoint, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/worker/test", info.getUrl());
    }
View Full Code Here

   
    @Test
    public void testWriteRequestWithCustomWorkerRoot() throws Exception {
        GTaskEndpoint custom = createEndpoint("test?workerRoot=lazy");
        exchange.getIn().setBody("anything");
        TaskOptions options = binding.writeRequest(custom, exchange, null);
        queue.add(options);
        TaskStateInfo info = getTaskStateInfos().get(0);
        assertEquals("/lazy/test", info.getUrl());
    }
View Full Code Here

  @Override
  public void addWork(String workId, String url, Map<String, String> params)
    throws MalformedURLException, InterruptedException, ExecutionException {
    Queue queue = QueueFactory.getQueue(workId);
    TaskOptions options = TaskOptions.Builder.withUrl(url);
    options.method(Method.POST);
    for(String name : params.keySet()) {
      options.param(name, params.get(name));
    }
    options.header("Host", BackendServiceFactory.getBackendService().getBackendAddress("worker",0));
    queue.add(options);      
  }
View Full Code Here

  @Override
  public void addWork(String workId, String url, Map<String, String> params)
    throws MalformedURLException, InterruptedException, ExecutionException {
    Queue queue = QueueFactory.getQueue(workId);
    TaskOptions options = TaskOptions.Builder.withUrl(url);
    options.method(Method.POST);
    for(String name : params.keySet()) {
      options.param(name, params.get(name));
    }
    queue.add(options);
  }
View Full Code Here

      error(resp, "Malformed JSON could not be parsed: " + e.toString());
      return;
    }
    LOG.info("JSON received: " + json.toString());
    JSONObject o;
    TaskOptions task;
    String email = userService.getEmail();
    for (int i = 0; i < json.length(); i++) {
      try {
        o = json.getJSONObject(i);
        task = TaskOptions.Builder.withUrl(UploadDataTask.URL).method(Method.POST)
View Full Code Here

     *
     * @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.withUrl(getWorkerRoot(endpoint) + endpoint.getPath());
        writeRequestHeaders(endpoint, exchange, answer);
        writeRequestBody(endpoint, exchange, answer);
        // TODO: consider TaskOptions method (POST, GET, ...)
        return answer;
    }
View Full Code Here

      if (md.hasProblem()) {
        md.setWhen(new Date());
        String key = AMessageDAO.createMessageDescriptor(md);

        Queue queue = QueueFactory.getQueue("serverError");
        TaskOptions taskOptions = TaskOptions.Builder.withUrl("/sendAll").param(SendMessageServlet.PARAMETER_SERVER, key).method(Method.POST);
        queue.add(taskOptions);
      }
    }

    writeStatusListToResponse(resp, statusList);
View Full Code Here

      partialDevices.add(device);
      int partialSize = partialDevices.size();
      if (partialSize == Datastore.MULTICAST_SIZE || counter == total) {
        String multicastKey = Datastore.createMulticast(partialDevices);
        logger.fine("Queuing " + partialSize + " devices on multicast " + multicastKey);
        TaskOptions taskOptions = TaskOptions.Builder.withUrl("/send")
            .param(SendMessageServlet.PARAMETER_MULTICAST, multicastKey)
            .param(SendMessageServlet.PARAMETER_SERVER, req.getParameter(SendMessageServlet.PARAMETER_SERVER))
            .method(Method.POST);
        queue.add(taskOptions);
        partialDevices.clear();
View Full Code Here

     * 全文検索用インデックスを作成するTaskQueueを追加する。
     * @param keys NicoliveのキーのList
     */
    private void addTaskQueue(List<Key> keys) {
        if (0 < keys.size()) {
            TaskOptions options =
                    TaskOptions.Builder
                        .withUrl("/GenerateNicoliveIndex")
                        .method(Method.POST);
            for (Key key : keys) {
                options = options.param("keys[]", Datastore.keyToString(key));
            }

            QueueFactory.getQueue("generate-nicoliveindex").add(options);
        }
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.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.