- Notifications
You must be signed in to change notification settings - Fork66
License
Apache-2.0, Unknown licenses found
Licenses found
cadence-workflow/cadence-java-samples
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
These samples demonstrate various capabilities of Java Cadence client and server. You can learn more about Cadence at:
HelloWorld Samples
The following samples demonstrate:
- HelloActivity: a single activity workflow
- HelloActivityRetry: how to retry an activity
- HelloAsync: how to call activities asynchronously and wait for them using Promises
- HelloAsyncLambda: how to run part of a workflow asynchronously in a separate task (thread)
- HelloAsyncActivityCompletion: an asynchronous activity implementation
- HelloChild: a child workflow
- HelloException: exception propagation and wrapping
- HelloQuery: a query
- HelloSignal: sending and handling a signal
- HelloPeriodic: a sample workflow that executes an activity periodically forever
- HelloSearchAttributes: how to use search attributes
- HelloCron: a cron workflow
FileProcessing demonstrates task routing features. The sample workflow downloads a file, processes it, and uploadsthe result to a destination. The first activity can be picked up by any worker. However, the second and third activitiesmust be executed on the same host as the first one.
Run the following commands:
git clone https://github.com/uber/cadence-java-samples cd cadence-java-samplesIn the IntelliJ user interface, navigate toFile->New->Project from Existing Sources.
Select the cloned directory. In theImport Project page, selectImport project from external model,chooseGradle and then clickNext->Finish.
./gradlew buildRun Cadence Server using Docker Compose:
curl -O https://raw.githubusercontent.com/uber/cadence/master/docker/docker-compose.ymldocker-compose upIf this does not work, see the instructions for running Cadence Serverathttps://github.com/uber/cadence/blob/master/README.md.
To register thesamples-domain domain, run the following command once before running any samples:
./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomainOr using Cadence CLI:
cadence --domain samples-domain domain registerThe Cadence Server running in a docker container includes a Web UI.
Connect tohttp://localhost:8088.
Enter thesamples-domain domain. You'll see a "No Results" page. After running any sample, change the filter in thetop right corner from "Open" to "Closed" to see the list of the completed workflows.
Click on aRUN ID of a workflow to see more details about it. Try different view formats to get a different level ofdetails about the execution history.
Command Line Interface Documentation
Each sample has specific requirements for running it. The following sections contain information abouthow to run each of the samples after you've built them using the preceding instructions.
Don't forget to check unit tests found under src/test/java!
To run the hello world samples:
./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivityRetry./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsync./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsyncActivityCompletion./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsyncLambda./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloChild./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloException./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloPeriodic./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloQuery./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloSignal./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloSearchAttributes./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloCronThis sample has two executables. Execute each command in a separate terminal window. The first commandruns the worker that hosts the workflow and activities implementation. To demonstrate that activitiesexecute together, we recommend that you run more than one instance of this worker.
./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorkerThe second command starts workflows. Each invocation starts a new workflow execution.
./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarterCadence implementation of theCamunda BPMN trip booking example
Demonstrates Cadence approach to SAGA.
To run:
./gradlew -q execute -PmainClass=com.uber.cadence.samples.bookingsaga.TripBookingSagaExample of how to start a cadence worker service using Spring Boot Framework
To run:
# Start Cadence Server# see https://github.com/uber/cadence/tree/master/docker# register domain./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain./gradlew -q execute -PmainClass=com.uber.cadence.samples.spring.CadenceSamplesApplicationApache 2.0 License, please seeLICENSE for details.
About
Resources
License
Apache-2.0, Unknown licenses found
Licenses found
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.