1
+ /*
2
+ * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Modifications copyright (C) 2017 Uber Technologies, Inc.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not
7
+ * use this file except in compliance with the License. A copy of the License is
8
+ * located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed on
13
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+
18
+ package com .uber .cadence .samples .clientsamples ;
19
+
20
+ import com .uber .cadence .WorkflowExecution ;
21
+ import com .uber .cadence .client .WorkflowClient ;
22
+ import com .uber .cadence .client .WorkflowOptions ;
23
+ import com .uber .cadence .samples .spring .common .Constant ;
24
+ import com .uber .cadence .samples .spring .models .SampleMessage ;
25
+ import com .uber .cadence .samples .spring .workflows .HelloWorldWorkflow ;
26
+ import java .time .Duration ;
27
+
28
+ public class HelloWorldSample {
29
+ public static void main (String [] args ) {
30
+ WorkflowClient workflowClient = CadenceUtil .getWorkflowClient ();
31
+ WorkflowOptions workflowOptions =
32
+ new WorkflowOptions .Builder ()
33
+ .setExecutionStartToCloseTimeout (Duration .ofSeconds (30 ))
34
+ .setTaskList (Constant .TASK_LIST )
35
+ .build ();
36
+
37
+ HelloWorldWorkflow helloWorldWorkflow =
38
+ workflowClient .newWorkflowStub (HelloWorldWorkflow .class , workflowOptions );
39
+ WorkflowExecution execution =
40
+ WorkflowClient .start (helloWorldWorkflow ::sayHello , new SampleMessage ("Uber" ));
41
+ System .out .printf ("WorkflowID: %s, RunID: %s" , execution .getWorkflowId (), execution .getRunId ());
42
+ }
43
+ }
0 commit comments