Skip to content

Commit 76713f2

Browse files
authored
Change to v0.26.0 release of SDK (#21)
SDK renamed task list to task queue.
1 parent c73b084 commit 76713f2

Some content is hidden

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

47 files changed

+235
-233
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ choose **Gradle** and then click **Next**->**Finish**.
4747

4848
Run Temporal Server using Docker Compose:
4949

50-
curl -L https://github.com/temporalio/temporal/releases/download/v0.25.0/docker.tar.gz | tar -xz --strip-components 1 docker/docker-compose.yml
50+
curl -L https://github.com/temporalio/temporal/releases/download/v0.26.0/docker.tar.gz | tar -xz --strip-components 1 docker/docker-compose.yml
5151
docker-compose up
5252

5353
If this does not work, see the instructions for running Temporal Server at https://github.com/temporalio/temporal/blob/master/README.md.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repositories {
2727
}
2828

2929
dependencies {
30-
implementation group: 'io.temporal', name: 'temporal-sdk', version: '0.25.0'
30+
implementation group: 'io.temporal', name: 'temporal-sdk', version: '0.26.0'
3131
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
3232
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
3333

src/main/java/io/temporal/samples/bookingsaga/TripBookingSaga.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
public class TripBookingSaga {
3030

31-
static final String TASK_LIST = "TripBooking";
31+
static final String TASK_QUEUE = "TripBooking";
3232

3333
@SuppressWarnings("CatchAndPrintStackTrace")
3434
public static void main(String[] args) {
@@ -37,11 +37,11 @@ public static void main(String[] args) {
3737
// client that can be used to start and signal workflows
3838
WorkflowClient client = WorkflowClient.newInstance(service);
3939

40-
// worker factory that can be used to create workers for specific task lists
40+
// worker factory that can be used to create workers for specific task queues
4141
WorkerFactory factory = WorkerFactory.newInstance(client);
4242

43-
// Worker that listens on a task list and hosts both workflow and activity implementations.
44-
Worker worker = factory.newWorker(TASK_LIST);
43+
// Worker that listens on a task queue and hosts both workflow and activity implementations.
44+
Worker worker = factory.newWorker(TASK_QUEUE);
4545

4646
// Workflows are stateful. So you need a type to create instances.
4747
worker.registerWorkflowImplementationTypes(TripBookingWorkflowImpl.class);
@@ -52,10 +52,10 @@ public static void main(String[] args) {
5252

5353
// Start all workers created by this factory.
5454
factory.start();
55-
System.out.println("Worker started for task list: " + TASK_LIST);
55+
System.out.println("Worker started for task queue: " + TASK_QUEUE);
5656

5757
// now we can start running instances of our saga - its state will be persisted
58-
WorkflowOptions options = WorkflowOptions.newBuilder().setTaskList(TASK_LIST).build();
58+
WorkflowOptions options = WorkflowOptions.newBuilder().setTaskQueue(TASK_QUEUE).build();
5959
TripBookingWorkflow trip1 = client.newWorkflowStub(TripBookingWorkflow.class, options);
6060
try {
6161
trip1.bookTrip("trip1");

src/main/java/io/temporal/samples/fileprocessing/FileProcessingStarter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
package io.temporal.samples.fileprocessing;
2121

22-
import static io.temporal.samples.fileprocessing.FileProcessingWorker.TASK_LIST;
22+
import static io.temporal.samples.fileprocessing.FileProcessingWorker.TASK_QUEUE;
2323

2424
import io.temporal.client.WorkflowClient;
2525
import io.temporal.client.WorkflowOptions;
@@ -37,7 +37,7 @@ public static void main(String[] args) throws Exception {
3737
FileProcessingWorkflow workflow =
3838
client.newWorkflowStub(
3939
FileProcessingWorkflow.class,
40-
WorkflowOptions.newBuilder().setTaskList(TASK_LIST).build());
40+
WorkflowOptions.newBuilder().setTaskQueue(TASK_QUEUE).build());
4141

4242
System.out.println("Executing FileProcessingWorkflow");
4343

src/main/java/io/temporal/samples/fileprocessing/FileProcessingWorker.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,32 @@
3434
*/
3535
public class FileProcessingWorker {
3636

37-
static final String TASK_LIST = "FileProcessing";
37+
static final String TASK_QUEUE = "FileProcessing";
3838

3939
public static void main(String[] args) {
4040

41-
String hostSpecifiTaskList = ManagementFactory.getRuntimeMXBean().getName();
41+
String hostSpecifiTaskQueue = ManagementFactory.getRuntimeMXBean().getName();
4242

4343
// gRPC stubs wrapper that talks to the local docker instance of temporal service.
4444
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
4545
// client that can be used to start and signal workflows
4646
WorkflowClient client = WorkflowClient.newInstance(service);
4747

48-
// worker factory that can be used to create workers for specific task lists
48+
// worker factory that can be used to create workers for specific task queues
4949
WorkerFactory factory = WorkerFactory.newInstance(client);
50-
// Worker that listens on a task list and hosts both workflow and activity implementations.
51-
final Worker workerForCommonTaskList = factory.newWorker(TASK_LIST);
52-
workerForCommonTaskList.registerWorkflowImplementationTypes(FileProcessingWorkflowImpl.class);
53-
StoreActivitiesImpl storeActivityImpl = new StoreActivitiesImpl(hostSpecifiTaskList);
54-
workerForCommonTaskList.registerActivitiesImplementations(storeActivityImpl);
50+
// Worker that listens on a task queue and hosts both workflow and activity implementations.
51+
final Worker workerForCommonTaskQueue = factory.newWorker(TASK_QUEUE);
52+
workerForCommonTaskQueue.registerWorkflowImplementationTypes(FileProcessingWorkflowImpl.class);
53+
StoreActivitiesImpl storeActivityImpl = new StoreActivitiesImpl(hostSpecifiTaskQueue);
54+
workerForCommonTaskQueue.registerActivitiesImplementations(storeActivityImpl);
5555

56-
// Get worker to poll the host-specific task list.
57-
final Worker workerForHostSpecificTaskList = factory.newWorker(hostSpecifiTaskList);
58-
workerForHostSpecificTaskList.registerActivitiesImplementations(storeActivityImpl);
56+
// Get worker to poll the host-specific task queue.
57+
final Worker workerForHostSpecificTaskQueue = factory.newWorker(hostSpecifiTaskQueue);
58+
workerForHostSpecificTaskQueue.registerActivitiesImplementations(storeActivityImpl);
5959

6060
// Start all workers created by this factory.
6161
factory.start();
62-
System.out.println("Worker started for task list: " + TASK_LIST);
63-
System.out.println("Worker Started for activity task List: " + hostSpecifiTaskList);
62+
System.out.println("Worker started for task queue: " + TASK_QUEUE);
63+
System.out.println("Worker Started for activity task Queue: " + hostSpecifiTaskQueue);
6464
}
6565
}

src/main/java/io/temporal/samples/fileprocessing/FileProcessingWorkflowImpl.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@
3030
* This implementation of FileProcessingWorkflow downloads the file, zips it, and uploads it to a
3131
* destination. An important requirement for such a workflow is that while a first activity can run
3232
* on any host, the second and third must run on the same host as the first one. This is achieved
33-
* through use of a host specific task list. The first activity returns the name of the host
34-
* specific task list and all other activities are dispatched using the stub that is configured with
35-
* it. This assumes that FileProcessingWorker has a worker running on the same task list.
33+
* through use of a host specific task queue. The first activity returns the name of the host
34+
* specific task queue and all other activities are dispatched using the stub that is configured
35+
* with it. This assumes that FileProcessingWorker has a worker running on the same task queue.
3636
*/
3737
public class FileProcessingWorkflowImpl implements FileProcessingWorkflow {
3838

39-
// Uses the default task list shared by the pool of workers.
40-
private final StoreActivities defaultTaskListStore;
39+
// Uses the default task queue shared by the pool of workers.
40+
private final StoreActivities defaultTaskQueueStore;
4141

4242
public FileProcessingWorkflowImpl() {
4343
// Create activity clients.
4444
ActivityOptions ao =
4545
ActivityOptions.newBuilder()
4646
.setScheduleToCloseTimeout(Duration.ofSeconds(10))
47-
.setTaskList(FileProcessingWorker.TASK_LIST)
47+
.setTaskQueue(FileProcessingWorker.TASK_QUEUE)
4848
.build();
49-
this.defaultTaskListStore = Workflow.newActivityStub(StoreActivities.class, ao);
49+
this.defaultTaskQueueStore = Workflow.newActivityStub(StoreActivities.class, ao);
5050
}
5151

5252
@Override
@@ -61,19 +61,19 @@ public void processFile(URL source, URL destination) {
6161
}
6262

6363
private void processFileImpl(URL source, URL destination) {
64-
StoreActivities.TaskListFileNamePair downloaded = defaultTaskListStore.download(source);
64+
StoreActivities.TaskQueueFileNamePair downloaded = defaultTaskQueueStore.download(source);
6565

66-
// Now initialize stubs that are specific to the returned task list.
66+
// Now initialize stubs that are specific to the returned task queue.
6767
ActivityOptions hostActivityOptions =
6868
ActivityOptions.newBuilder()
69-
.setTaskList(downloaded.getHostTaskList())
69+
.setTaskQueue(downloaded.getHostTaskQueue())
7070
.setScheduleToCloseTimeout(Duration.ofSeconds(10))
7171
.build();
7272
StoreActivities hostSpecificStore =
7373
Workflow.newActivityStub(StoreActivities.class, hostActivityOptions);
7474

7575
// Call processFile activity to zip the file.
76-
// Call the activity to process the file using worker-specific task list.
76+
// Call the activity to process the file using worker-specific task queue.
7777
String processed = hostSpecificStore.process(downloaded.getFileName());
7878
// Call upload activity to upload the zipped file.
7979
hostSpecificStore.upload(processed, destination);

src/main/java/io/temporal/samples/fileprocessing/StoreActivities.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
@ActivityInterface
2626
public interface StoreActivities {
2727

28-
final class TaskListFileNamePair {
29-
private String hostTaskList;
28+
final class TaskQueueFileNamePair {
29+
private String hostTaskQueue;
3030
private String fileName;
3131

32-
public TaskListFileNamePair(String hostTaskList, String fileName) {
33-
this.hostTaskList = hostTaskList;
32+
public TaskQueueFileNamePair(String hostTaskQueue, String fileName) {
33+
this.hostTaskQueue = hostTaskQueue;
3434
this.fileName = fileName;
3535
}
3636

3737
/** Jackson needs it */
38-
public TaskListFileNamePair() {}
38+
public TaskQueueFileNamePair() {}
3939

40-
public String getHostTaskList() {
41-
return hostTaskList;
40+
public String getHostTaskQueue() {
41+
return hostTaskQueue;
4242
}
4343

4444
public String getFileName() {
@@ -65,7 +65,7 @@ public String getFileName() {
6565
* Downloads file to local disk.
6666
*
6767
* @param url remote file location
68-
* @return local task list and downloaded file name
68+
* @return local task queue and downloaded file name
6969
*/
70-
TaskListFileNamePair download(URL url);
70+
TaskQueueFileNamePair download(URL url);
7171
}

src/main/java/io/temporal/samples/fileprocessing/StoreActivitiesImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
/** Store activities implementation. */
3131
public class StoreActivitiesImpl implements StoreActivities {
3232

33-
private final String hostSpecificTaskList;
33+
private final String hostSpecificTaskQueue;
3434

35-
public StoreActivitiesImpl(String taskList) {
36-
this.hostSpecificTaskList = taskList;
35+
public StoreActivitiesImpl(String taskQueue) {
36+
this.hostSpecificTaskQueue = taskQueue;
3737
}
3838

3939
@Override
40-
public TaskListFileNamePair download(URL url) {
40+
public TaskQueueFileNamePair download(URL url) {
4141
try {
4242
byte[] binary = Resources.toByteArray(url);
4343
File destination = new File(Files.createTempDir(), "downloaded");
4444
Files.write(binary, destination);
4545
System.out.println(
4646
"download activity: downloaded from " + url + " to " + destination.getAbsolutePath());
47-
return new TaskListFileNamePair(hostSpecificTaskList, destination.getAbsolutePath());
47+
return new TaskQueueFileNamePair(hostSpecificTaskQueue, destination.getAbsolutePath());
4848
} catch (IOException e) {
4949
throw Workflow.wrap(e);
5050
}

src/main/java/io/temporal/samples/hello/HelloActivity.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*/
3939
public class HelloActivity {
4040

41-
static final String TASK_LIST = "HelloActivity";
41+
static final String TASK_QUEUE = "HelloActivity";
4242

4343
/** Workflow interface has to have at least one method annotated with @WorkflowMethod. */
4444
@WorkflowInterface
@@ -88,22 +88,22 @@ public static void main(String[] args) {
8888
// client that can be used to start and signal workflows
8989
WorkflowClient client = WorkflowClient.newInstance(service);
9090

91-
// worker factory that can be used to create workers for specific task lists
91+
// worker factory that can be used to create workers for specific task queues
9292
WorkerFactory factory = WorkerFactory.newInstance(client);
93-
// Worker that listens on a task list and hosts both workflow and activity implementations.
94-
Worker worker = factory.newWorker(TASK_LIST);
93+
// Worker that listens on a task queue and hosts both workflow and activity implementations.
94+
Worker worker = factory.newWorker(TASK_QUEUE);
9595
// Workflows are stateful. So you need a type to create instances.
9696
worker.registerWorkflowImplementationTypes(GreetingWorkflowImpl.class);
9797
// Activities are stateless and thread safe. So a shared instance is used.
9898
worker.registerActivitiesImplementations(new GreetingActivitiesImpl());
99-
// Start listening to the workflow and activity task lists.
99+
// Start listening to the workflow and activity task queues.
100100
factory.start();
101101

102102
// Start a workflow execution. Usually this is done from another program.
103-
// Uses task list from the GreetingWorkflow @WorkflowMethod annotation.
103+
// Uses task queue from the GreetingWorkflow @WorkflowMethod annotation.
104104
GreetingWorkflow workflow =
105105
client.newWorkflowStub(
106-
GreetingWorkflow.class, WorkflowOptions.newBuilder().setTaskList(TASK_LIST).build());
106+
GreetingWorkflow.class, WorkflowOptions.newBuilder().setTaskQueue(TASK_QUEUE).build());
107107
// Execute a workflow waiting for it to complete. See {@link
108108
// io.temporal.samples.hello.HelloSignal}
109109
// for an example of starting workflow without waiting synchronously for its result.

src/main/java/io/temporal/samples/hello/HelloActivityRetry.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
public class HelloActivityRetry {
4141

42-
static final String TASK_LIST = "HelloActivityRetry";
42+
static final String TASK_QUEUE = "HelloActivityRetry";
4343

4444
@WorkflowInterface
4545
public interface GreetingWorkflow {
@@ -109,19 +109,19 @@ public static void main(String[] args) {
109109
// client that can be used to start and signal workflows
110110
WorkflowClient client = WorkflowClient.newInstance(service);
111111

112-
// worker factory that can be used to create workers for specific task lists
112+
// worker factory that can be used to create workers for specific task queues
113113
WorkerFactory factory = WorkerFactory.newInstance(client);
114-
// Worker that listens on a task list and hosts both workflow and activity implementations.
115-
Worker worker = factory.newWorker(TASK_LIST);
114+
// Worker that listens on a task queue and hosts both workflow and activity implementations.
115+
Worker worker = factory.newWorker(TASK_QUEUE);
116116
// Workflows are stateful. So you need a type to create instances.
117117
worker.registerWorkflowImplementationTypes(GreetingWorkflowImpl.class);
118118
// Activities are stateless and thread safe. So a shared instance is used.
119119
worker.registerActivitiesImplementations(new GreetingActivitiesImpl());
120-
// Start listening to the workflow and activity task lists.
120+
// Start listening to the workflow and activity task queues.
121121
factory.start();
122122

123-
// Get a workflow stub using the same task list the worker uses.
124-
WorkflowOptions workflowOptions = WorkflowOptions.newBuilder().setTaskList(TASK_LIST).build();
123+
// Get a workflow stub using the same task queue the worker uses.
124+
WorkflowOptions workflowOptions = WorkflowOptions.newBuilder().setTaskQueue(TASK_QUEUE).build();
125125
GreetingWorkflow workflow = client.newWorkflowStub(GreetingWorkflow.class, workflowOptions);
126126
// Execute a workflow waiting for it to complete.
127127
String greeting = workflow.getGreeting("World");

0 commit comments

Comments
 (0)