Package com.google.appengine.api.taskqueue

Examples of com.google.appengine.api.taskqueue.TaskOptions.header()


    t.param("run_as_a_service", Boolean.TRUE.toString());
   
    t.param("queue", queueName);
   
    t.method(Method.GET);
    t.header("Host", BackendServiceFactory.getBackendService().getBackendAddress(AH_BUILTIN_PYTHON_BUNDLE));
   
    return t;
  }
}
View Full Code Here


  private TaskOptions toTaskOptions(Task task) {
    final QueueSettings queueSettings = task.getQueueSettings();
    TaskOptions taskOptions = TaskOptions.Builder.withUrl(TaskHandler.HANDLE_TASK_URL);
    if (queueSettings.getOnBackend() != null) {
      taskOptions.header("Host", BackendServiceFactory.getBackendService().getBackendAddress(
          queueSettings.getOnBackend()));
    } else {

      String versionHostname = RetryHelper.runWithRetries(new Callable<String>() {
        @Override
View Full Code Here

            version = service.getCurrentVersion();
          }
          return service.getVersionHostname(module, version);
        }
      }, RetryParams.getDefaultInstance(), MODULES_EXCEPTION_HANDLER);
      taskOptions.header("Host", versionHostname);
    }

    Long delayInSeconds = queueSettings.getDelayInSeconds();
    if (null != delayInSeconds) {
      taskOptions.countdownMillis(delayInSeconds * 1000L);
 
View Full Code Here

      ShardedJobSettings settings) {
    TaskOptions taskOptions = TaskOptions.Builder.withMethod(TaskOptions.Method.POST)
        .url(settings.getControllerPath())
        .param(JOB_ID_PARAM, jobId)
        .param(TASK_ID_PARAM, taskId);
    taskOptions.header("Host", settings.getTaskQueueTarget());
    QueueFactory.getQueue(settings.getQueueName()).add(tx, taskOptions);
  }

  private void scheduleWorkerTask(Transaction tx, ShardedJobSettings settings,
      IncrementalTaskState<T> state, Long eta) {
View Full Code Here

    TaskOptions taskOptions = TaskOptions.Builder.withMethod(TaskOptions.Method.POST)
        .url(settings.getWorkerPath())
        .param(TASK_ID_PARAM, state.getTaskId())
        .param(JOB_ID_PARAM, state.getJobId())
        .param(SEQUENCE_NUMBER_PARAM, String.valueOf(state.getSequenceNumber()));
    taskOptions.header("Host", settings.getTaskQueueTarget());
    if (eta != null) {
      taskOptions.etaMillis(eta);
    }
    QueueFactory.getQueue(settings.getQueueName()).add(tx, taskOptions);
  }
View Full Code Here

    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

  }

  private TaskOptions toTaskOptions(Task task) {
    TaskOptions taskOptions = TaskOptions.Builder.withUrl(TaskHandler.HANDLE_TASK_URL);
    if (task.getOnBackend() != null) {
      taskOptions.header("Host",
          BackendServiceFactory.getBackendService().getBackendAddress(task.getOnBackend()));
    }
    addProperties(taskOptions, task.toProperties());
    String taskName = task.getName();
    if (null != taskName) {
View Full Code Here

        .url(settings.getControllerPath())
        .param(JOB_ID_PARAM, state.getJobId())
        .param(SEQUENCE_NUMBER_PARAM, "" + state.getNextSequenceNumber())
        .countdownMillis(settings.getMillisBetweenPolls());
    if (settings.getControllerBackend() != null) {
      taskOptions.header("Host",
          BackendServiceFactory.getBackendService().getBackendAddress(
              settings.getControllerBackend()));
    }
    QueueFactory.getQueue(settings.getControllerQueueName()).add(tx, taskOptions);
  }
View Full Code Here

        .url(settings.getWorkerPath())
        .param(TASK_ID_PARAM, state.getTaskId())
        .param(JOB_ID_PARAM, state.getJobId())
        .param(SEQUENCE_NUMBER_PARAM, "" + state.getNextSequenceNumber());
    if (settings.getWorkerBackend() != null) {
      taskOptions.header("Host",
          BackendServiceFactory.getBackendService().getBackendAddress(settings.getWorkerBackend()));
    }
    QueueFactory.getQueue(settings.getWorkerQueueName()).add(tx, taskOptions);
  }
View Full Code Here

                    options = options.url(String.valueOf(value));
                    break;
                case "headers":
                    if (value instanceof Map) {
                        for (Entry<String, String> header : ((Map<String, String>)value).entrySet()) {
                            options = options.header(header.getKey(), header.getValue());
                        }
                    } else {
                        throw new RuntimeException("The headers key/value pairs should be passed as a map.");
                    }
                    break;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.