Skip to content

Commit b81016a

Browse files
author
Tihomir Surdilovic
committed
update examples in readme
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 30aaa49 commit b81016a

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,15 @@ functions:
117117
states:
118118
- name: Greet
119119
type: operation
120-
actionMode: sequential
121120
actions:
122121
- functionRef:
123122
refName: greetingFunction
124123
arguments:
125-
name: ".greet.name"
124+
name: "${ .greet.name }"
126125
actionDataFilter:
127-
dataResultsPath: ".payload.greeting"
126+
results: "${ .payload.greeting }"
128127
stateDataFilter:
129-
output: ".greeting"
128+
output: "${ .greeting }"
130129
end: true
131130
```
132131
@@ -158,7 +157,6 @@ assertTrue(workflow.getStates().get(0) instanceof OperationState);
158157
OperationState operationState = (OperationState) workflow.getStates().get(0);
159158
assertEquals("Greet", operationState.getName());
160159
assertEquals(DefaultState.Type.OPERATION, operationState.getType());
161-
162160
...
163161
```
164162

@@ -167,20 +165,21 @@ assertEquals(DefaultState.Type.OPERATION, operationState.getType());
167165
You can also programmatically create Workflow instances, for example:
168166

169167
``` java
170-
Workflow workflow = new Workflow().withId("test-workflow").withName("test-workflow-name").withVersion("1.0")
168+
Workflow workflow = new Workflow()
169+
.withId("test-workflow")
170+
.withName("test-workflow-name")
171+
.withVersion("1.0")
172+
.withStart(new Start().withStateName("MyDelayState"))
171173
.withFunctions(new Functions(Arrays.asList(
172174
new FunctionDefinition().withName("testFunction")
173175
.withOperation("testSwaggerDef#testOperationId")))
174176
)
175177
.withStates(Arrays.asList(
176-
new DelayState().withName("delayState").withType(DELAY)
177-
.withStart(
178-
new Start().withKind(Start.Kind.DEFAULT)
179-
)
178+
new DelayState().withName("MyDelayState").withType(DELAY)
179+
.withTimeDelay("PT1M")
180180
.withEnd(
181-
new End().withKind(End.Kind.DEFAULT)
181+
new End().withTerminate(true)
182182
)
183-
.withTimeDelay("PT1M")
184183
)
185184
);
186185
```
@@ -218,16 +217,16 @@ boolean isValidWorkflow = workflowValidator.setSource("WORKFLOW_MODEL_JSON/YAML"
218217
If you build your Workflow programmatically, you can validate it as well:
219218

220219
``` java
221-
Workflow workflow = new Workflow().withId("test-workflow").withVersion("1.0")
220+
Workflow workflow = new Workflow()
221+
.withId("test-workflow")
222+
.withVersion("1.0")
223+
.withStart(new Start().withStateName("MyDelayState"))
222224
.withStates(Arrays.asList(
223-
new DelayState().withName("delayState").withType(DefaultState.Type.DELAY)
224-
.withStart(
225-
new Start().withKind(Start.Kind.DEFAULT)
226-
)
225+
new DelayState().withName("MyDelayState").withType(DefaultState.Type.DELAY)
226+
.withTimeDelay("PT1M")
227227
.withEnd(
228-
new End().withKind(End.Kind.DEFAULT)
228+
new End().withTerminate(true)
229229
)
230-
.withTimeDelay("PT1M")
231230
));
232231
);
233232

0 commit comments

Comments
 (0)