@@ -23,8 +23,7 @@ implementation group: 'com.uber.cadence', name: 'cadence-client', version: '<lat
2323```
2424Also add the following dependencies that cadence-client relies on:
2525``` gradle
26- implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
27- implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
26+ implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.18'
2827```
2928Make sure that the following code compiles:
3029``` java
@@ -38,7 +37,7 @@ public class GettingStarted {
3837
3938 public interface HelloWorld {
4039 @WorkflowMethod
41- void sayHello (String name );
40+ String sayHello (String name );
4241 }
4342
4443}
@@ -67,7 +66,6 @@ Also add the following logback config file somewhere in your classpath:
6766
6867Let's add ` HelloWorldImpl ` with the ` sayHello ` method that just logs the "Hello ..." and returns.
6968``` java
70- import com.uber.cadence.worker.Worker ;
7169import com.uber.cadence.workflow.Workflow ;
7270import com.uber.cadence.workflow.WorkflowMethod ;
7371import org.slf4j.Logger ;
@@ -78,14 +76,16 @@ public class GettingStarted {
7876
7977 public interface HelloWorld {
8078 @WorkflowMethod
81- void sayHello (String name );
79+ String sayHello (String name );
8280 }
8381
8482 public static class HelloWorldImpl implements HelloWorld {
8583
8684 @Override
8785 public void sayHello (String name ) {
88- logger. info(" Hello " + name + " !" );
86+ final String result = " Hello " + name + " !" ;
87+ logger. info(" {}" , result);
88+ return result;
8989 }
9090 }
9191}
@@ -94,17 +94,33 @@ To link the :workflow: implementation to the Cadence framework, it should be reg
9494a Cadence Service. By default the :worker: connects to the locally running Cadence service.
9595
9696``` java
97- public static void main(String [] args) {
98- WorkflowClient workflowClient =
99- WorkflowClient . newInstance(
100- new WorkflowServiceTChannel (ClientOptions . defaultInstance()),
101- WorkflowClientOptions . newBuilder(). setDomain(DOMAIN ). build());
102- // Get worker to poll the task list.
103- WorkerFactory factory = WorkerFactory . newInstance(workflowClient);
104- Worker worker = factory. newWorker(TASK_LIST );
105- worker. registerWorkflowImplementationTypes(HelloWorldImpl . class);
106- factory. start();
107- }
97+ import com.uber.cadence.client.WorkflowClient ;
98+ import com.uber.cadence.client.WorkflowClientOptions ;
99+ import com.uber.cadence.serviceclient.ClientOptions ;
100+ import com.uber.cadence.serviceclient.WorkflowServiceTChannel ;
101+ import com.uber.cadence.worker.Worker ;
102+ import com.uber.cadence.worker.WorkerFactory ;
103+
104+ // other imports
105+
106+ public class GettingStarted {
107+
108+ private static final String DOMAIN = " test-domain" ;
109+ private static final String TASK_LIST = " HelloWorldTaskList" ;
110+
111+ // existing code
112+
113+ public static void main (String [] args ) {
114+ WorkflowClient workflowClient =
115+ WorkflowClient . newInstance(
116+ new WorkflowServiceTChannel (ClientOptions . defaultInstance()),
117+ WorkflowClientOptions . newBuilder(). setDomain(DOMAIN ). build());
118+ // Get worker to poll the task list.
119+ WorkerFactory factory = WorkerFactory . newInstance(workflowClient);
120+ Worker worker = factory. newWorker(TASK_LIST );
121+ worker. registerWorkflowImplementationTypes(HelloWorldImpl . class);
122+ factory. start();
123+ }
108124```
109125
110126The code is slightly different if you are using client version prior to 3.0 . 0 :
0 commit comments