Skip to content

Commit b9007a1

Browse files
author
Maxim Fateev
committed
Changed id generation to alphanumeric
1 parent 6a2d187 commit b9007a1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingSaga.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public class TripBookingSaga {
2727

2828
static final String TASK_LIST = "TripBooking";
2929

30+
@SuppressWarnings("CatchAndPrintStackTrace")
3031
public static void main(String[] args) {
31-
3232
// Get worker to poll the common task list.
3333
Worker.Factory factory = new Worker.Factory(DOMAIN);
3434
final Worker workerForCommonTaskList = factory.newWorker(TASK_LIST);

src/main/java/com/uber/cadence/samples/hello/HelloSignal.java

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

2020
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
2121

22-
import com.google.common.base.Charsets;
2322
import com.uber.cadence.client.WorkflowClient;
2423
import com.uber.cadence.client.WorkflowOptions;
2524
import com.uber.cadence.worker.Worker;
@@ -29,7 +28,7 @@
2928
import java.time.Duration;
3029
import java.util.ArrayList;
3130
import java.util.List;
32-
import java.util.Random;
31+
import org.apache.commons.lang.RandomStringUtils;
3332

3433
/**
3534
* Demonstrates asynchronous signalling of a workflow. Requires a local instance of Cadence server
@@ -95,10 +94,8 @@ public static void main(String[] args) throws Exception {
9594
worker.registerWorkflowImplementationTypes(GreetingWorkflowImpl.class);
9695
factory.start();
9796

98-
// In real applications use a business level ID like customerId or orderId
99-
byte[] idBytes = new byte[10];
100-
new Random().nextBytes(idBytes);
101-
String workflowId = new String(idBytes, Charsets.UTF_8);
97+
// In a real application use a business ID like customer ID or order ID
98+
String workflowId = RandomStringUtils.randomAlphabetic(10);
10299

103100
// Start a workflow execution. Usually this is done from another program.
104101
WorkflowClient workflowClient = WorkflowClient.newInstance(DOMAIN);

0 commit comments

Comments
 (0)