Skip to content
yogeshnachnani edited this page Apr 12, 2016 · 3 revisions

The Flux client library provides constructs to express and maintain workflows using vanilla Java code.

####Download To begin, include the maven dependency in your code (currently available in Flipkart's internal artifactory)

<dependency>
    <groupId>com.flipkart.flux</groupId>
    <artifactId>client</artifactId>
    <version>1.0-SNAPSHOT</version>
<dependency>

<repository>
    <snapshots/>
    <id>snapshots</id>
    <name>libs-snapshots</name>
    <url>http://artifactory.nm.flipkart.com:8081/artifactory/libs-snapshots-local</url>
</repository>

Some of the basic constructs are as follows

####@WorkFlow A method can be marked with the @Workflow annotation to indicate that it is a workflow definition. Note that a method annotated with @Workflow must return void

@Workflow supports the following parameters:

Parameter Name Mandatory Description
version yes Flux runtime will ensure that @Tasks of the same version are executed as part of workflow orchestration

####@Task Any method can be marked with the @Task annotation. This annotation can be used to denote re-entrant, stateless methods capable of executing a single, logical piece of work. As will be explained later, a @Task method can be executed on any JVM in a flux container. Thus, it is important that these methods work only on the input data and do not rely on any other state variables of a class.

@Task supports the following parameters:

Parameter Name Mandatory Description
version yes Flux runtime will ensure that @Tasks of the same version are executed as part of workflow orchestration
timeout yes Specifies the time limit given for task execution
retries no; default 0 Specifies the number of times the orchestrator should re-attempt failed/timed out tasks

DI Support

User code can use javax.inject annotations. These will be read and used by Guice, the DI framework used by Flux.

For example, the tasks to perform within a workflow would be part of various classes which can be DI-ed in the Workflow definition class that specifies the workflow using @Workflow annotation

Clone this wiki locally