Quick example that shows how to use conductor-client-spring
to run annotated workers.
- Add this dependency to your project.
implementation 'org.conductoross:conductor-client-spring:4.0.1'
- Configure the conductor client in
application.properties
.
conductor.client.base-path=http://localhost:8080/api
- Annotate methods in your Component with
@WorkerTask
, e.g.: ConductorWorkers:
package com.netflix.conductor.example;
import com.netflix.conductor.sdk.workflow.task.WorkerTask;
import org.springframework.stereotype.Component;
@Component
public class ConductorWorkers {
@WorkerTask(value = "hello-world", threadCount = 5, pollingInterval = 200)
public String helloWorld() {
return "Hello World!";
}
}
- That's it! - Run the project.
./gradlew bootRun