Search in sources :

Example 16 with Worker

use of com.netflix.conductor.client.worker.Worker in project conductor by Netflix.

the class Main method main.

public static void main(String[] args) {
    TaskClient taskClient = new TaskClient();
    // Point this to the server API
    taskClient.setRootURI("http://localhost:8080/api/");
    // number of threads used to execute workers.  To avoid starvation, should be same or more than number of workers
    int threadCount = 2;
    Worker worker1 = new SampleWorker("task_1");
    Worker worker2 = new SampleWorker("task_5");
    // Create TaskRunnerConfigurer
    TaskRunnerConfigurer configurer = new TaskRunnerConfigurer.Builder(taskClient, Arrays.asList(worker1, worker2)).withThreadCount(threadCount).build();
    // Start the polling and execution of tasks
    configurer.init();
}
Also used : TaskClient(com.netflix.conductor.client.http.TaskClient) Worker(com.netflix.conductor.client.worker.Worker) TaskRunnerConfigurer(com.netflix.conductor.client.automator.TaskRunnerConfigurer)

Aggregations

TaskClient (com.netflix.conductor.client.http.TaskClient)16 Worker (com.netflix.conductor.client.worker.Worker)16 Test (org.junit.Test)14 TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)12 Task (com.netflix.conductor.common.metadata.tasks.Task)11 CountDownLatch (java.util.concurrent.CountDownLatch)10 ConductorClientException (com.netflix.conductor.client.exceptions.ConductorClientException)2 HashMap (java.util.HashMap)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 InstanceStatus (com.netflix.appinfo.InstanceInfo.InstanceStatus)1 TaskRunnerConfigurer (com.netflix.conductor.client.automator.TaskRunnerConfigurer)1 MetricsContainer (com.netflix.conductor.client.telemetry.MetricsContainer)1 MetricsContainer.getPollTimer (com.netflix.conductor.client.telemetry.MetricsContainer.getPollTimer)1 MetricsContainer.incrementTaskPollCount (com.netflix.conductor.client.telemetry.MetricsContainer.incrementTaskPollCount)1 PropertyFactory (com.netflix.conductor.client.worker.PropertyFactory)1 RetryUtil (com.netflix.conductor.common.utils.RetryUtil)1 EurekaClient (com.netflix.discovery.EurekaClient)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 Arrays (java.util.Arrays)1