Skip to content

Commit

Permalink
Add link to microservice orchestration example
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Aug 23, 2023
1 parent 60d4492 commit c1594f5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ The solution with iWF:
* Natural to represent business
* Builtin & rich support for operation tooling

It's so simple & easy to do that the code can be shown here!

See the running code in [Java samples](https://github.com/indeedeng/iwf-java-samples/tree/main#microservice-ochestration) and [Golang samples](https://github.com/indeedeng/iwf-golang-samples#microservice-orchestration).
```java
public class OrchestrationWorkflow implements ObjectWorkflow {

Expand Down Expand Up @@ -101,6 +104,21 @@ public class OrchestrationWorkflow implements ObjectWorkflow {
DataAttributeDef.create(String.class, DA_DATA1)
);
}

@Override
public List<CommunicationMethodDef> getCommunicationSchema() {
return Arrays.asList(
SignalChannelDef.create(Void.class, READY_SIGNAL)
);
}

// NOTE: this is to demonstrate how you can read/write workflow persistence in RPC
@RPC
public String swap(Context context, String newData, Persistence persistence, Communication communication) {
String oldData = persistence.getDataAttribute(DA_DATA1, String.class);
persistence.setDataAttribute(DA_DATA1, newData);
return oldData;
}
}

class State1 implements WorkflowState<String> {
Expand Down

0 comments on commit c1594f5

Please sign in to comment.