com.netflix.conductor.common.metadata.tasks.Task.setDomain()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中com.netflix.conductor.common.metadata.tasks.Task.setDomain()方法的一些代码示例,展示了Task.setDomain()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setDomain()方法的具体详情如下:
包路径:com.netflix.conductor.common.metadata.tasks.Task
类名称:Task
方法名:setDomain

Task.setDomain介绍

暂无

代码示例

代码示例来源:origin: Netflix/conductor

private void setTaskDomains(List<Task> tasks, Workflow wf) {
  Map<String, String> taskToDomain = wf.getTaskToDomain();
  if (taskToDomain != null) {
    // Check if all tasks have the same domain "*"
    String domainstr = taskToDomain.get("*");
    if (domainstr != null) {
      String[] domains = domainstr.split(",");
      tasks.forEach(task -> {
        // Filter out SystemTask
        if (!TaskType.isSystemTask(task.getTaskType())) {
          // Check which domain worker is polling
          // Set the task domain
          task.setDomain(getActiveDomain(task.getTaskType(), domains));
        }
      });
    } else {
      tasks.forEach(task -> {
        if (!TaskType.isSystemTask(task.getTaskType())) {
          String taskDomainstr = taskToDomain.get(task.getTaskType());
          if (taskDomainstr != null) {
            task.setDomain(getActiveDomain(task.getTaskType(), taskDomainstr.split(",")));
          }
        }
      });
    }
  }
}

代码示例来源:origin: Netflix/conductor

@Test
public void testBatchPoll() throws Exception{
  Task task = new Task();
  task.setTaskType("SIMPLE");
  task.setWorkerId("123");
  task.setDomain("test");
  List<Task> listOfTasks = new ArrayList<>();
  listOfTasks.add(task);
  when(mockTaskService.batchPoll(anyString(), anyString(), anyString(), anyInt(), anyInt())).thenReturn(listOfTasks);
  assertEquals(listOfTasks, taskResource.batchPoll("SIMPLE", "123",
      "test", 1, 100));
}

代码示例来源:origin: Netflix/conductor

@Test
public void testGetInProgressTasks() throws Exception {
  Task task = new Task();
  task.setTaskType("SIMPLE");
  task.setWorkerId("123");
  task.setDomain("test");
  task.setStatus(Task.Status.IN_PROGRESS);
  List<Task> listOfTasks = new ArrayList<>();
  listOfTasks.add(task);
  when(mockTaskService.getTasks(anyString(), anyString(), anyInt())).thenReturn(listOfTasks);
  assertEquals(listOfTasks, taskResource.getTasks("SIMPLE", "123", 123));
}

代码示例来源:origin: Netflix/conductor

@Test
public void testPoll() throws Exception {
  Task task = new Task();
  task.setTaskType("SIMPLE");
  task.setWorkerId("123");
  task.setDomain("test");
  when(mockTaskService.poll(anyString(), anyString(), anyString())).thenReturn(task);
  assertEquals(task, taskResource.poll("SIMPLE", "123", "test"));
}

代码示例来源:origin: Netflix/conductor

@Test
public void testGetPendingTaskForWorkflow() {
  Task task = new Task();
  task.setTaskType("SIMPLE");
  task.setWorkerId("123");
  task.setDomain("test");
  task.setStatus(Task.Status.IN_PROGRESS);
  when(mockTaskService.getPendingTaskForWorkflow(anyString(), anyString())).thenReturn(task);
  assertEquals(task, taskResource.getPendingTaskForWorkflow("SIMPLE", "123"));
}

代码示例来源:origin: Netflix/conductor

@Test
  public void search() {
    Task task = new Task();
    task.setTaskType("SIMPLE");
    task.setWorkerId("123");
    task.setDomain("test");
    task.setStatus(Task.Status.IN_PROGRESS);
    TaskSummary taskSummary = new TaskSummary(task);
    ArrayList<TaskSummary> listOfTaskSummary = new ArrayList<TaskSummary>() {{
      add(taskSummary);
    }};
    SearchResult<TaskSummary> searchResult = new SearchResult<TaskSummary>(100, listOfTaskSummary);
    listOfTaskSummary.add(taskSummary);

    when(mockTaskService.search(anyInt(), anyInt(), anyString(), anyString(), anyString())).thenReturn(searchResult);
    assertEquals(searchResult, taskResource.search(0,100,"asc", "*", "*"));
  }
}

代码示例来源:origin: Netflix/conductor

@Test
public void testGetTask() throws Exception {
  Task task = new Task();
  task.setTaskType("SIMPLE");
  task.setWorkerId("123");
  task.setDomain("test");
  task.setStatus(Task.Status.IN_PROGRESS);
  when(mockTaskService.getTask(anyString())).thenReturn(task);
  assertEquals(task, taskResource.getTask("123"));
}

代码示例来源:origin: Netflix/conductor

to.setWorkflowTask( fromProto( from.getWorkflowTask() ) );
to.setDomain( from.getDomain() );
if (from.hasInputMessage()) {
  to.setInputMessage( fromProto( from.getInputMessage() ) );

代码示例来源:origin: Netflix/conductor

public Task copy() {
  Task copy = new Task();
  copy.setCallbackAfterSeconds(callbackAfterSeconds);
  copy.setCallbackFromWorker(callbackFromWorker);
  copy.setCorrelationId(correlationId);
  copy.setInputData(inputData);
  copy.setOutputData(outputData);
  copy.setReferenceTaskName(referenceTaskName);
  copy.setStartDelayInSeconds(startDelayInSeconds);
  copy.setTaskDefName(taskDefName);
  copy.setTaskType(taskType);
  copy.setWorkflowInstanceId(workflowInstanceId);
  copy.setWorkflowType(workflowType);
  copy.setResponseTimeoutSeconds(responseTimeoutSeconds);
  copy.setStatus(status);
  copy.setRetryCount(retryCount);
  copy.setPollCount(pollCount);
  copy.setTaskId(taskId);
  copy.setWorkflowTask(workflowTask);
  copy.setDomain(domain);
  copy.setInputMessage(inputMessage);
  copy.setOutputMessage(outputMessage);
  copy.setRateLimitPerFrequency(rateLimitPerFrequency);
  copy.setRateLimitFrequencyInSeconds(rateLimitFrequencyInSeconds);
  copy.setExternalInputPayloadStoragePath(externalInputPayloadStoragePath);
  copy.setExternalOutputPayloadStoragePath(externalOutputPayloadStoragePath);
  return copy;
}

代码示例来源:origin: com.netflix.conductor/conductor-core

private void setTaskDomains(List<Task> tasks, Workflow wf) {
  Map<String, String> taskToDomain = wf.getTaskToDomain();
  if (taskToDomain != null) {
    // Check if all tasks have the same domain "*"
    String domainstr = taskToDomain.get("*");
    if (domainstr != null) {
      String[] domains = domainstr.split(",");
      tasks.forEach(task -> {
        // Filter out SystemTask
        if (!TaskType.isSystemTask(task.getTaskType())) {
          // Check which domain worker is polling
          // Set the task domain
          task.setDomain(getActiveDomain(task.getTaskType(), domains));
        }
      });
    } else {
      tasks.forEach(task -> {
        if (!TaskType.isSystemTask(task.getTaskType())) {
          String taskDomainstr = taskToDomain.get(task.getTaskType());
          if (taskDomainstr != null) {
            task.setDomain(getActiveDomain(task.getTaskType(), taskDomainstr.split(",")));
          }
        }
      });
    }
  }
}

代码示例来源:origin: com.netflix.conductor/conductor-grpc

to.setWorkflowTask( fromProto( from.getWorkflowTask() ) );
to.setDomain( from.getDomain() );
if (from.hasInputMessage()) {
  to.setInputMessage( fromProto( from.getInputMessage() ) );

代码示例来源:origin: com.netflix.conductor/conductor-common

public Task copy() {
  Task copy = new Task();
  copy.setCallbackAfterSeconds(callbackAfterSeconds);
  copy.setCallbackFromWorker(callbackFromWorker);
  copy.setCorrelationId(correlationId);
  copy.setInputData(inputData);
  copy.setOutputData(outputData);
  copy.setReferenceTaskName(referenceTaskName);
  copy.setStartDelayInSeconds(startDelayInSeconds);
  copy.setTaskDefName(taskDefName);
  copy.setTaskType(taskType);
  copy.setWorkflowInstanceId(workflowInstanceId);
  copy.setWorkflowType(workflowType);
  copy.setResponseTimeoutSeconds(responseTimeoutSeconds);
  copy.setStatus(status);
  copy.setRetryCount(retryCount);
  copy.setPollCount(pollCount);
  copy.setTaskId(taskId);
  copy.setWorkflowTask(workflowTask);
  copy.setDomain(domain);
  copy.setInputMessage(inputMessage);
  copy.setOutputMessage(outputMessage);
  copy.setRateLimitPerFrequency(rateLimitPerFrequency);
  copy.setRateLimitFrequencyInSeconds(rateLimitFrequencyInSeconds);
  copy.setExternalInputPayloadStoragePath(externalInputPayloadStoragePath);
  copy.setExternalOutputPayloadStoragePath(externalOutputPayloadStoragePath);
  return copy;
}

相关文章

Task类方法