Coder Social home page Coder Social logo

indeedeng / iwf-java-sdk Goto Github PK

View Code? Open in Web Editor NEW
12.0 11.0 8.0 713 KB

Java SDK for iwf workflow engine(simple & powerful workflow as code engine based on Cadence/Temporal)

License: Apache License 2.0

Java 99.62% Shell 0.38%
java java-sdk open-source orchestration orchestration-engine orchestration-framework workflow workflow-as-code workflow-engine

iwf-java-sdk's Introduction

iwf-java-sdk

Coverage Status Build status

Java SDK for iWF workflow engine

See samples for how to use this SDK to build your workflow.

Requirements

  • Java 1.8+

How to use

Here is the link to all the versions available to use. Also the Java docs for the latest version. For the latest version, MVN Repository website may have 1~2 days delay to show up.

Gradle

// https://mvnrepository.com/artifact/io.iworkflow/iwf-java-sdk
implementation 'io.iworkflow:iwf-java-sdk:2.5.+'

Maven

<!-- https://mvnrepository.com/artifact/io.iworkflow/iwf-java-sdk -->
<dependency>
    <groupId>io.iworkflow</groupId>
    <artifactId>iwf-java-sdk</artifactId>
    <version>2.5.+</version>
    <type>pom</type>
</dependency>

Concepts

To implement a workflow, the two most core interfaces are

A workflow can contain any number of WorkflowStates.

See more in https://github.com/indeedeng/iwf#what-is-iwf

How to build & run

Using IntelliJ

  1. Check out the idl submodule by running the command: git submodule update --init --recursive
  2. In "Build, Execution, Deployment" -> "Gradle", choose "wrapper task in Gradle build script" for "Use gradle from".
  3. Open Gradle tab, click "build" under "build" to build the project

Development Guide

Update IDL

Run the command git submodule update --remote --merge to update IDL to the latest commit

Repo structure

  • .github/workflows/: the GithubActions workflows
  • iwf-idl/: the idl submodule
  • script/: some scripts for GithubActions and testing
  • src/: Java source code
    • main/java/io/iworkflow/core/: SDK code
      • command/: the command implementation
      • communication/: the communication implementation
      • mapper/: the mapper with IDL
      • persistence/: the persistence implementation
      • validator/: some validators
      • Client.java: the client implemntation
      • ...java ...
    • test/java/io/iworkflow/: Java test code (currently only integ test)
      • spring/: the integ test setup of using Spring as REST controller
      • integ/: the integration tests
        • XyzTest.java: a file for test cases
        • xyz/: the iWF workflow implementation for the integration test cases

Development Plan

1.0

  • Start workflow API
  • Executing start/decide APIs and completing workflow
  • Parallel execution of multiple states
  • Timer command
  • Signal command
  • SearchAttribute
  • DataAttribute
  • StateExecutionLocal
  • Signal workflow API
  • Get workflow DataAttributes/SearchAttributes API
  • Get workflow API
  • Search workflow API
  • Cancel workflow API
  • Reset workflow API
  • InternalChannel command
  • AnyCommandCompleted Decider trigger type
  • More workflow start options: IdReusePolicy, cron schedule, retry
  • StateOption: WaitUntil/Execute API timeout and retry policy
  • Reset workflow by stateId/StateExecutionId

1.1

  • New search attribute types: Double, Bool, Datetime, Keyword array, Text
  • Workflow start options: initial search attributes

1.2

  • Skip timer API for testing/operation
  • Decider trigger type: any command combination

1.3

  • Support failing workflow with results
  • Improve workflow uncompleted error return(canceled, failed, timeout, terminated)

1.4

  • Support PROCEED_ON_FAILURE for WaitUntilApiFailurePolicy

2.0

  • Renaming some concepts/APIs with breaking changes(see releaste notes)
  • Support workflow RPC

2.1

  • Support caching on persistence

2.2

  • Support atomic conditional complete workflow by checking signal/internal channel emptiness

2.3

  • Support dynamic data/search attributes and internal/signal channel definition
  • Support state options overridden dynamically
  • Support describe workflow API

2.4

  • Support execute API failure policy
  • Support RPC persistence locking policy

2.5

  • Add waitForStateExecutionCompletion API

iwf-java-sdk's People

Contributors

bell-kevin avatar duoertai avatar lanespade avatar longquanzheng avatar mixydubs avatar samuel27m avatar zklgame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iwf-java-sdk's Issues

Check signal

  1. Check if signal name have conflicts
  2. Check if sending a valid signal

allow setting workflowType

by default it's the simple name but in some advanced use case, ppl want to set the value differently (e.g. DSL workflow)

Fix/refactor WorkflowOptions for client

Remove state options from it for client as it should be loaded from workflow state rather than from request, otherwise it will be confusing.
Remove minimum from method and let start api specify timeout
Also remove one overload to make it clear

Use map[string]Object as initial search attribute

unregistered client can use raw workflow state option instead

WorkflowOptions will be only for client and not for unregistered client

Allow customize timeout and backoff retry for State Start/Decide APIs

Currently it's using
default start to close timeout from iwf-server:

10 s

default backoff retry from Temporal server:

		// The default RetryPolicy provided by the server specifies:
		// - InitialInterval of 1 second
		// - BackoffCoefficient of 2.0
		// - MaximumInterval of 100 x InitialInterval
		// - MaximumAttempts of 0 (unlimited)

Implement workflowState Start API

implement https://github.com/cadence-oss/iwf-java/blob/main/core/src/main/java/iwf/core/spring/controller/ApiController.java#L23

AC & steps (separate PRs):

  1. Copy the SDK code from prototype
  2. Copy a demo workflow as user code in test folder, and let it run with the SDK (with the spring controller)
  3. Provide a workflowRegistry with register APIs to register workflow type(use workflow class short name)
  4. On invoking workflowState.Start, find the workflow from workflowRegistry, and invoke the start API from user code, collect the command requests and return back to caller

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.