Skip to content

Commit 3d5b195

Browse files
authored
Merge pull request #111 from tsurdilo/timeoutsadd
Adding timeouts
2 parents 933c355 + c01513f commit 3d5b195

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+292
-76
lines changed

api/src/main/java/io/serverlessworkflow/api/interfaces/State.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.serverlessworkflow.api.error.Error;
2020
import io.serverlessworkflow.api.filters.StateDataFilter;
2121
import io.serverlessworkflow.api.states.DefaultState.Type;
22+
import io.serverlessworkflow.api.timeouts.TimeoutsDefinition;
2223
import io.serverlessworkflow.api.transitions.Transition;
2324

2425
import java.util.List;
@@ -43,4 +44,6 @@ public interface State {
4344
String getCompensatedBy();
4445

4546
Map<String, String> getMetadata();
47+
48+
TimeoutsDefinition getTimeouts();
4649
}

api/src/main/java/io/serverlessworkflow/api/mapper/WorkflowModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import io.serverlessworkflow.api.states.DefaultState;
3535
import io.serverlessworkflow.api.states.OperationState;
3636
import io.serverlessworkflow.api.states.ParallelState;
37+
import io.serverlessworkflow.api.timeouts.TimeoutsDefinition;
3738
import io.serverlessworkflow.api.transitions.Transition;
3839
import io.serverlessworkflow.api.workflow.*;
3940

api/src/main/java/io/serverlessworkflow/api/serializers/WorkflowSerializer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ public void serialize(Workflow workflow,
9898
workflow.getExpressionLang());
9999
}
100100

101-
if (workflow.getExecTimeout() != null) {
102-
gen.writeObjectField("execTimeout", workflow.getExecTimeout());
103-
}
104-
105101
if (workflow.isKeepActive()) {
106102
gen.writeBooleanField("keepActive", workflow.isKeepActive());
107103
}
@@ -159,6 +155,10 @@ public void serialize(Workflow workflow,
159155
gen.writeObjectField("constants", workflow.getConstants().getConstantsDef());
160156
}
161157

158+
if(workflow.getTimeouts() != null ) {
159+
gen.writeObjectField("timeouts", workflow.getTimeouts());
160+
}
161+
162162
if (workflow.getStates() != null && !workflow.getStates().isEmpty()) {
163163
gen.writeArrayFieldStart("states");
164164
for (State state : workflow.getStates()) {

api/src/main/java/io/serverlessworkflow/api/workflow/Constants.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ public class Constants {
2323
private String refValue;
2424
private JsonNode constantsDef;
2525

26+
public Constants() {}
27+
28+
public Constants(String refValue) {
29+
this.refValue = refValue;
30+
}
31+
32+
public Constants(JsonNode constantsDef) {
33+
this.constantsDef = constantsDef;
34+
}
35+
2636
public String getRefValue() {
2737
return refValue;
2838
}

api/src/main/java/io/serverlessworkflow/api/workflow/Secrets.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ public class Secrets {
2121
private String refValue;
2222
private List<String> secretDefs;
2323

24+
public Secrets() {}
25+
26+
public Secrets(String refValue) {
27+
this.refValue = refValue;
28+
}
29+
30+
public Secrets(List<String> secretDefs) {
31+
this.secretDefs = secretDefs;
32+
}
33+
2434
public String getRefValue() {
2535
return refValue;
2636
}

api/src/main/resources/schema/actions/action.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
"description": "References a sub-workflow to invoke",
2020
"$ref": "../functions/subflowref.json"
2121
},
22-
"timeout": {
23-
"type": "string",
24-
"description": "Time period to wait for function execution to complete"
25-
},
2622
"actionDataFilter": {
2723
"$ref": "../filters/actiondatafilter.json"
2824
}

api/src/main/resources/schema/branches/branch.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"type": "object",
1515
"$ref": "../actions/action.json"
1616
}
17+
},
18+
"timeouts": {
19+
"$ref": "../timeouts/timeoutsdef.json"
1720
}
1821
},
1922
"oneOf": [

api/src/main/resources/schema/states/callbackstate.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
"type" : "string",
1818
"description": "References an unique callback event name in the defined workflow events"
1919
},
20-
"timeout": {
21-
"type": "string",
22-
"description": "Time period to wait for incoming events (ISO 8601 format)"
23-
},
2420
"eventDataFilter": {
2521
"description": "Callback event data filter definition",
2622
"$ref": "../filters/eventdatafilter.json"

api/src/main/resources/schema/states/defaultstate.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
"type": "string",
5858
"minLength": 1,
5959
"description": "Unique Name of a workflow state which is responsible for compensation of this state"
60+
},
61+
"timeouts": {
62+
"$ref": "../timeouts/timeoutsdef.json"
6063
}
6164
},
6265
"required": [

api/src/main/resources/schema/states/eventstate.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
"type": "object",
2222
"$ref": "../events/onevents.json"
2323
}
24-
},
25-
"timeout": {
26-
"type": "string",
27-
"description": "Time period to wait for incoming events (ISO 8601 format)"
2824
}
2925
},
3026
"required": [

0 commit comments

Comments
 (0)