Skip to content

Commit

Permalink
Merge pull request #6 from indeedeng/update
Browse files Browse the repository at this point in the history
Update to use 1.0 library
  • Loading branch information
longquanzheng authored Dec 18, 2022
2 parents 2d50009 + a2d8fd3 commit b444ff6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-test"
implementation "javax.validation:validation-api:2.0.1.Final"

implementation "io.iworkflow:iwf-java-sdk:1.0.0-rc1"
implementation "io.iworkflow:iwf-java-sdk:1.0.0-final"

// openapi
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.iworkflow.controller;

import io.iworkflow.core.Client;
import io.iworkflow.core.ImmutableWorkflowStartOptions;
import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.core.options.WorkflowIdReusePolicy;
import io.iworkflow.core.ImmutableWorkflowOptions;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.gen.models.WorkflowStartOptions;
import io.iworkflow.workflow.basic.BasicWorkflow;
import io.iworkflow.workflow.basic.BasicWorkflowS1;
import org.springframework.http.ResponseEntity;
Expand All @@ -28,9 +28,9 @@ public BasicWorkflowController(
@GetMapping("/start")
public ResponseEntity<String> start() {
final String wfId = "basic-test-id" + System.currentTimeMillis() / 1000;
final WorkflowStartOptions startOptions = ImmutableWorkflowStartOptions.builder()
final WorkflowOptions startOptions = ImmutableWorkflowOptions.builder()
.workflowTimeoutSeconds(10)
.workflowIdReusePolicy(Optional.of(WorkflowIdReusePolicy.ALLOW_DUPLICATE))
.workflowIdReusePolicy(Optional.of(WorkflowStartOptions.WorkflowIDReusePolicyEnum.ALLOW_DUPLICATE))
.build();
final Integer input = 0;
final String runId = client.startWorkflow(BasicWorkflow.class, BasicWorkflowS1.StateId, input, wfId, startOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.iworkflow.controller;

import io.iworkflow.core.Client;
import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.workflow.interstatechannel.BasicInterStateChannelWorkflow;
import io.iworkflow.workflow.interstatechannel.BasicInterStateChannelWorkflowState0;
import org.springframework.http.ResponseEntity;
Expand All @@ -24,7 +24,7 @@ public InterstateChannelWorkflowController(
@GetMapping("/start")
public ResponseEntity<String> start() {
final String wfId = "basic-inter-state-test-id" + System.currentTimeMillis() / 1000;
final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10);
final WorkflowOptions startOptions = WorkflowOptions.minimum(10);
final Integer input = 1;
final String runId = client.startWorkflow(
BasicInterStateChannelWorkflow.class, BasicInterStateChannelWorkflowState0.STATE_ID, input, wfId, startOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.iworkflow.controller;

import io.iworkflow.core.Client;
import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.workflow.persistence.BasicPersistenceWorkflow;
import io.iworkflow.workflow.persistence.BasicPersistenceWorkflowState1;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.workflow.basic.BasicWorkflow;
import io.iworkflow.workflow.basic.BasicWorkflowS1;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -24,9 +24,9 @@ public PersistenceWorkflowController(
@GetMapping("/start")
public ResponseEntity<String> start() {
final String wfId = "basic-persistence-test-id" + System.currentTimeMillis() / 1000;
final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10);
final WorkflowOptions startOptions = WorkflowOptions.minimum(10);
final String runId = client.startWorkflow(
BasicPersistenceWorkflow.class, BasicPersistenceWorkflowState1.STATE_ID, "start", wfId, startOptions);
BasicWorkflow.class, BasicWorkflowS1.StateId, "start", wfId, startOptions);
final String output = client.getSimpleWorkflowResultWithWait(String.class, wfId);

return ResponseEntity.ok(String.format("runId: %s, output: %s", runId, output));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.iworkflow.controller;

import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.core.Client;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.workflow.signal.BasicSignalWorkflow;
import io.iworkflow.workflow.signal.BasicSignalWorkflowState1;
import io.iworkflow.core.Client;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -24,7 +24,7 @@ public SignalWorkflowController(
@GetMapping("/start")
public ResponseEntity<String> start() {
final String wfId = "basic-signal-test-id" + System.currentTimeMillis() / 1000;
final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10);
final WorkflowOptions startOptions = WorkflowOptions.minimum(10);
final Integer input = 1;
final String runId = client.startWorkflow(
BasicSignalWorkflow.class, BasicSignalWorkflowState1.STATE_ID, input, wfId, startOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.iworkflow.controller;

import io.iworkflow.core.Client;
import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.workflow.timer.BasicTimerWorkflow;
import io.iworkflow.workflow.timer.BasicTimerWorkflowState1;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,7 +25,7 @@ public TimerWorkflowController(
public ResponseEntity<String> start() {
final long startTs = System.currentTimeMillis();
final String wfId = "basic-timer-test-id" + startTs / 1000;
final WorkflowStartOptions startOptions = WorkflowStartOptions.minimum(10);
final WorkflowOptions startOptions = WorkflowOptions.minimum(10);
final Integer input = 5;

final String runId = client.startWorkflow(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.iworkflow.services;

import io.iworkflow.core.UntypedClient;
import io.iworkflow.core.WorkflowStartOptions;
import io.iworkflow.core.WorkflowOptions;
import io.iworkflow.models.ImmutableStartWorkflowResponse;
import io.iworkflow.models.SignalRequest;
import io.iworkflow.models.StartWorkflowResponse;
Expand Down Expand Up @@ -33,7 +33,7 @@ public StartWorkflowResponse startWorkflow(final String workflowName) {

String runId = untypedClient.startWorkflow(DynamicDslWorkflow.class.getSimpleName(),
adapter.getWorkflow().getId() + "-" + startState.getName(),
adapter.getFirstState(), workflowId, WorkflowStartOptions.minimum(100));
adapter.getFirstState(), workflowId, WorkflowOptions.minimum(100));
return ImmutableStartWorkflowResponse.builder()
.workflowId(workflowId)
.runId(runId)
Expand Down

0 comments on commit b444ff6

Please sign in to comment.