Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jmigueprieto committed Oct 14, 2024
1 parent 76ed504 commit bfea636
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 67 deletions.
81 changes: 14 additions & 67 deletions conductor-clients/java/conductor-java-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,31 @@
# Conductor Java Client/SDK V4
# Conductor Java SDK v4

## Overview
[Conductor](https://www.conductor-oss.org/) is the leading open-source orchestration platform allowing developers to build highly scalable distributed applications.

**This project is currently in incubating status**.
This Gradle project includes multiple modules that enable developers to manage, create, test, and run workflows and execute workers.

It is under active development and subject to changes as it evolves. While the core features are functional, the project is not yet considered stable, and breaking changes may occur as we refine the architecture and add new functionality.
## Projects

These changes are largely driven by **"dependency optimization"** and a redesign of the client to introduces filters, events and listeners to allow extensibility through callbacks or Event-Driven Architecture, IoC.
The Conductor Java SDK v4 is organized into several key modules to help developers build and manage workflows and workers with ease

This client has a reduced dependency set. The aim is to minimize Classpath pollution and prevent potential conflicts.
- **[conductor-client](conductor-client/README.md)**: This module provides the core client library to interact with Conductor through its HTTP API, enabling the creation, execution, and management of workflows, while also providing a framework for building workers.

Consider Netflix Eureka, a direct dependency of the OSS v3 client. Some users have reported version conflicts. To prevent these unnecessary conflicts and the hassle of managing exclusions in Gradle or Maven configurations, we’ve decided to remove this direct dependency.
- **[conductor-client-metrics](conductor-client-metrics/README.md)**: (Incubating) Provides metrics and monitoring capabilities for Conductor clients.

In OSS v3 client it's used by `TaskPollExecutor` before polling to make the following check:
- **[conductor-client-spring](conductor-client-spring/README.md)**: Provides Spring framework configurations, simplifying the use of Conductor client in Spring-based applications.

```java
if (eurekaClient != null
&& !eurekaClient.getInstanceRemoteStatus().equals(InstanceStatus.UP)
&& !discoveryOverride) {
LOGGER.debug("Instance is NOT UP in discovery - will not poll");
return;
}
```
- **[examples](examples/README.md)**: Samples demonstrating how to use the Conductor Java SDK to create and manage workflows, tasks, and workers. These examples provide practical starting points for developers integrating Conductor into their applications.

You will be able to achieve the same with a `PollFilter` (we plan to provide modules with some implementations). It could look something like this:
- **[sdk](sdk/README.md)**: The SDK module allows developers to create, test and execute workflows using code.

```java
var runnerConfigurer = new TaskRunnerConfigurer
.Builder(taskClient, List.of(new ApprovalWorker()))
.withThreadCount(10)
.withPollFilter((String taskType, String domain) -> {
return eurekaClient.getInstanceRemoteStatus().equals(InstanceStatus.UP);
})
.withListener(PollCompleted.class, (e) -> {
log.info("Poll Completed {}", e);
var timer = prometheusRegistry.timer("poll_completed", "type", e.getTaskType());
timer.record(e.getDuration());
})
.build();
- **orkes-client**: Extends the Conductor client by adding authentication needed for Orkes Conductor, and includes additional clients for interacting with endpoints specific to the Orkes-hosted Conductor platform.

runnerConfigurer.init();
```
- **orkes-spring**: Provides Spring framework configurations, simplifying the use of Orkes Conductor client in Spring-based applications.

The telemetry part was also removed but you can achieve the same with a MetricsCollector, or Events and Listeners as shown in the example.

### Breaking Changes
## Roadmap

While we aim to minimize breaking changes, there are a few areas where such changes are necessary.

Below are two specific examples of where changes may affect your existing code:

#### (1) Jersey Config

The `WorkflowClient` and other clients will retain the same methods, but constructors with dependencies on Jersey are being removed. For example:

```java
public WorkflowClient(ClientConfig config, ClientHandler handler) {
this(config, new DefaultConductorClientConfiguration(), handler);
}
```

#### (2) Eureka Client

In the Worker API we've removed the Eureka Client configuration option (from `TaskRunnerConfigurer`).

```java
* @param eurekaClient Eureka client - used to identify if the server is in discovery or
* not. When the server goes out of discovery, the polling is terminated. If passed
* null, discovery check is not done.
* @return Builder instance
*/
public Builder withEurekaClient(EurekaClient eurekaClient) {
this.eurekaClient = eurekaClient;
return this;
}
```

## TODO

Take a look at this board: https://github.com/orgs/conductor-oss/projects/3
For insights into the Conductor project's future plans and upcoming features, check out the roadmap here: [Conductor OSS Roadmap](https://github.com/orgs/conductor-oss/projects/3).

## Feedback

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Conductor Client Metrics

**Status: Incubating.**

Provides metrics and monitoring capabilities for Conductor clients.

It helps developers track the performance and health of their workers, offering insights into task execution times, error rates, and system throughput.

As an incubating module, it's still under development and subject to changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Conductor Client Spring

Provides Spring framework configurations, simplifying the use of Conductor client
in Spring-based applications.

## Getting Started

### Prerequisites
- Java 17 or higher
- A Spring boot Project Gradle properly setup with Gradle or Maven
- A running Conductor server (local or remote)

### Using Conductor Client Spring

1. **Add `conductor-client-spring` dependency to your project**

For Gradle:
```groovy
implementation 'org.conductoross:conductor-client-spring:4.0.0'
```

For Maven:
```xml
<dependency>
<groupId>org.conductoross</groupId>
<artifactId>conductor-client-spring</artifactId>
<version>4.0.0</version>
</dependency>
```

2. Add `com.netflix.conductor` to the component scan packages, e.g.:

```java
import org.springframework.boot.autoconfigure.SpringBootApplication;;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"com.netflix.conductor"})
public class MyApp {

}
```

3. Configure the client in `application.properties`

```properties
conductor.client.rootUri=http://localhost:8080/api
```

> **Note:** We are improving the Spring module to make the integration seamless. SEE: [[Java Client v4] Improve Spring module with auto-configuration](https://github.com/conductor-oss/conductor/issues/285)
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Conductor Client

This module provides the core client library to interact with Conductor through its HTTP API, enabling the creation, execution, and management of workflows, while also providing a framework for building workers.

## Getting Started

### Prerequisites
- Java 11 or higher
- A Gradle or Maven project properly set up
- A running Conductor server (local or remote)

### Using Conductor Client

1. **Add `conductor-client` dependency to your project**

For Gradle:
```groovy
implementation 'org.conductoross:conductor-client:4.0.0'
```

For Maven:
```xml
<dependency>
<groupId>org.conductoross</groupId>
<artifactId>conductor-client</artifactId>
<version>4.0.0</version>
</dependency>
```

2. **Create a `ConductorClient` instance**

Assuming your Conductor server is running at `localhost:8080`:

```java
import com.netflix.conductor.client.http.ConductorClient;

// … other code
var client = new ConductorClient("http://localhost:8080/api");
```

> **Note:** Use the Builder to configure options.
3. **Start a Workflow**

Use the [WorkflowClient](src/main/java/com/netflix/conductor/client/http/WorkflowClient.java) to start a workflow:

```java
import com.netflix.conductor.client.http.ConductorClient;
import com.netflix.conductor.client.http.WorkflowClient;
import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest;

// … other code
var client = new ConductorClient("http://localhost:8080/api");
var workflowClient = new WorkflowClient(client);
var workflowId = workflowClient.startWorkflow(new StartWorkflowRequest()
.withName("hello_workflow")
.withVersion(1));

System.out.println("Started workflow " + workflowId);
```

4. **Run a Worker**

```java
public class HelloWorker implements Worker {

@Override
public TaskResult execute(Task task) {
var taskResult = new TaskResult(task);
taskResult.setStatus(TaskResult.Status.COMPLETED);
taskResult.getOutputData().put("message", "Hello World!");
return taskResult;
}

@Override
public String getTaskDefName() {
return "hello_task";
}

public static void main(String[] args) {
var client = new ConductorClient("http://localhost:8080/api");
var taskClient = new TaskClient(client);
var runnerConfigurer = new TaskRunnerConfigurer
.Builder(taskClient, List.of(new HelloWorker()))
.withThreadCount(10)
.build();
runnerConfigurer.init();
}
}
```
5 changes: 5 additions & 0 deletions conductor-clients/java/conductor-java-sdk/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Examples

This module provides simple, illustrative examples to help users get started with the Conductor Java Client/SDK v4.

It demonstrates basic use cases and integrations, serving as a reference for developers to understand how to use Conductor from their applications.

0 comments on commit bfea636

Please sign in to comment.