Code Monkey home page Code Monkey logo

cadence-java-samples's Introduction

Java Cadence Samples

These samples demonstrate various capabilities of Java Cadence client and server. You can learn more about Cadence at:

Overview of the Samples

  • 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 uploads the result to a destination. The first activity can be picked up by any worker. However, the second and third activities must be executed on the same host as the first one.

Get the Samples

Run the following commands:

  git clone https://github.com/uber/cadence-java-samples
  cd cadence-java-samples

Import into IntelliJ

In the IntelliJ user interface, navigate to File->New->Project from Existing Sources.

Select the cloned directory. In the Import Project page, select Import project from external model, choose Gradle and then click Next->Finish.

Build the Samples

  ./gradlew build

Run Cadence Server

Run Cadence Server using Docker Compose:

curl -O https://raw.githubusercontent.com/uber/cadence/master/docker/docker-compose.yml
docker-compose up

If this does not work, see the instructions for running Cadence Server at https://github.com/uber/cadence/blob/master/README.md.

Register the Domain

To register the samples-domain domain, run the following command once before running any samples:

./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain

Or using Cadence CLI:

cadence --domain samples-domain domain register

See Cadence UI

The Cadence Server running in a docker container includes a Web UI.

Connect to http://localhost:8088.

Enter the samples-domain domain. You'll see a "No Results" page. After running any sample, change the filter in the top right corner from "Open" to "Closed" to see the list of the completed workflows.

Click on a RUN ID of a workflow to see more details about it. Try different view formats to get a different level of details about the execution history.

Install Cadence CLI

Command Line Interface Documentation

Run the samples

Each sample has specific requirements for running it. The following sections contain information about how 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!

Hello World

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.HelloCron

File Processing

This sample has two executables. Execute each command in a separate terminal window. The first command runs the worker that hosts the workflow and activities implementation. To demonstrate that activities execute together, we recommend that you run more than one instance of this worker.

./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorker

The second command starts workflows. Each invocation starts a new workflow execution.

./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter

Trip Booking

Cadence implementation of the Camunda BPMN trip booking example

Demonstrates Cadence approach to SAGA.

To run:

./gradlew -q execute -PmainClass=com.uber.cadence.samples.bookingsaga.TripBookingSaga

Sprint Boot Application

Example 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.CadenceSamplesApplication

cadence-java-samples's People

Contributors

abhishekj720 avatar barakalon avatar chopincode avatar demirkayaender avatar denyska avatar halakaraki avatar ibarrajo avatar longquanzheng avatar manikandanrs avatar meiliang86 avatar mfateev avatar mindaugasbarcauskas avatar raymondkroon avatar shijiesheng avatar spicypepper999 avatar timduly4 avatar trojanbug avatar vancexu avatar vytautas-karpavicius avatar yux0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cadence-java-samples's Issues

Update examples to newer mockito version

The samples for mocking with Mockito don't work properly on newer versions due to mockito/mockito#1206 -- the Mockito-generated class inherits the @ActivityMethod annotation and then cadence complains with an error like:

java.lang.IllegalArgumentException: Found @ActivityMethod annotation on "public xxx foo.bar.baz.MyActivities$MockitoMock$1369009352.createOrder(java.lang.String[]) " This annotation can be used only on the interface method it implements.

Per the referenced Mockito issue, it seems that newer versions have an API to suppress copying of such annotations to the generated class, which I guess has to be used here.

External resource communication sample

It will be very useful to have a sample of workflow where communicating with external resource is done.

Use case
External resource should be called from Workflow\Activity and can provide answer asynchronously but after very long period of time 1 day, 2 days.... 1 year.

  • Cadence Workflow should not DDos external resource.
  • Cadence Workflow fulfils SLA of external resource - e.g not more then n requests per m seconds to endpoint\service of external resource

clean up compiling warnings

> Task :compileJava
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloMetric.java:33: warning: [deprecation] Buckets in com.uber.m3.tally has been deprecated
import com.uber.m3.tally.Buckets;
                        ^
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:149: warning: [unchecked] unchecked cast
        return (T) MyStruct.fromBytes(content);
                                     ^
  required: T
  found:    MyStruct
  where T is a type-variable:
    T extends Object declared in method <T>fromData(byte[],Class<T>,Type)
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloMetric.java:176: warning: [deprecation] Buckets in com.uber.m3.tally has been deprecated
  public Histogram histogram(final String name, final Buckets buckets) {
                                                      ^
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:23: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns reservationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:29: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns reservationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:35: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns reservationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:41: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns cancellationConfirmationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:48: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns cancellationConfirmationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/bookingsaga/TripBookingActivities.java:55: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param name customer name
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns cancellationConfirmationID.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/calculation/Activities.java:23: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
   * @param a
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/calculation/Activities.java:24: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
   * @param b
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/calculation/Activities.java:23: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
   * @param a
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns a*b.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloLocalActivity.java:42: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:58: warning: [StringSplitter] String.split(String) has surprising behavior
      String[] ss = s.split("#");
                           ^
    (see https://errorprone.info/bugpattern/StringSplitter)
  Did you mean 'List<String> ss = Splitter.on('#').splitToList(s);'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:77: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:111: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @param values
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:112: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @return
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:113: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @throws DataConverterException
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:138: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @param content
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:139: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @param valueClass
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:140: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @param valueType
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:141: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @param <T>
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:142: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @return
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloDataConverter.java:143: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
     * @throws DataConverterException
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSideEffect.java:46: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return set value */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns set value.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSignal.java:50: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return list of greeting strings that were received through the waitForNameMethod. This
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns list of greeting strings that were received through the waitForNameMethod. This'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloCancellation.java:49: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSearchAttributes.java:49: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSearchAttributes.java:206: warning: [JavaTimeDefaultTimeZone] ZonedDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
    ZonedDateTime currentDateTime = ZonedDateTime.now();
                                                     ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'ZonedDateTime currentDateTime = ZonedDateTime.now(ZoneId.systemDefault());'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloActivity.java:42: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloQuery.java:52: warning: [UnusedVariable] The field 'greeting' is never read.
    private String greeting;
                   ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean to remove this line?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloActivityRetry.java:45: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSignalAndResponse.java:65: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return list of greeting strings that were received through the receiveName Method. This
       ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns list of greeting strings that were received through the receiveName Method. This'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSignalAndResponse.java:201: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
   * @param workflowClient
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSignalAndResponse.java:202: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
   * @param workflowId
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloSignalAndResponse.java:203: warning: [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
   * @param runId
     ^
    (see http://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags)
  Did you mean '*'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloMetric.java:125: warning: [UnusedVariable] The local variable 'httpServer' is never read.
    HTTPServer httpServer = new HTTPServer(new InetSocketAddress(9098), registry);
               ^
    (see https://errorprone.info/bugpattern/UnusedVariable)
  Did you mean to remove this line or 'new HTTPServer(new InetSocketAddress(9098), registry);'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloMetric.java:62: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloWorkerSetup.java:44: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloChild.java:69: warning: [UnusedMethod] Private method 'demoAsyncChildRun' is never used.
    private String demoAsyncChildRun(String name) {
                   ^
    (see https://errorprone.info/bugpattern/UnusedMethod)
  Did you mean to remove this line?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloChild.java:41: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloAsyncActivityCompletion.java:46: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
/Users/qlong/indeed/cadence-java-samples/src/main/java/com/uber/cadence/samples/hello/HelloAsyncLambda.java:45: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
    /** @return greeting string */
        ^
    (see http://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** Returns greeting string.'?
43 warnings

Warnings in the HelloSaga

C:\Users\anton\IdeaProjects\cadence-java-samples\src\main\java\com\uber\cadence\samples\hello\HelloSaga.java:24: warning: [MissingOverride] execute implements method in ChildWorkflowOperation; expected @Override
    public void execute(int amount) {
                ^
    (see https://errorprone.info/bugpattern/MissingOverride)
  Did you mean '@Override public void execute(int amount) {'?
C:\Users\anton\IdeaProjects\cadence-java-samples\src\main\java\com\uber\cadence\samples\hello\HelloSaga.java:37: warning: [MissingOverride] compensate implements method in ChildWorkflowCompensation; expected @Override
    public void compensate(int amount) {
                ^
    (see https://errorprone.info/bugpattern/MissingOverride)
  Did you mean '@Override public void compensate(int amount) {'?
C:\Users\anton\IdeaProjects\cadence-java-samples\src\main\java\com\uber\cadence\samples\hello\HelloSaga.java:52: warning: [MissingOverride] execute implements method in ActivityOperation; expected @Override
    public void execute(int amount) {
                ^
    (see https://errorprone.info/bugpattern/MissingOverride)
  Did you mean '@Override public void execute(int amount) {'?
C:\Users\anton\IdeaProjects\cadence-java-samples\src\main\java\com\uber\cadence\samples\hello\HelloSaga.java:56: warning: [MissingOverride] compensate implements method in ActivityOperation; expected @Override
    public void compensate(int amount) {
                ^
    (see https://errorprone.info/bugpattern/MissingOverride)
  Did you mean '@Override public void compensate(int amount) {'?
4 warnings

cadence-java-client not getting build.

I am referring following to develop Cadence Java client examples.
https://github.com/uber/cadence-java-client.
While I am executing I am getting following error: ./gradlew build --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify task execution listener.
> tried to access field org.gradle.api.tasks.SourceTask.source from class com.github.sherter.googlejavaformatgradleplugin.FormatTask

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.internal.event.ListenerNotificationException: Failed to notify task execution listener.
       at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
       at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
       at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
       at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
       at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
       at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
       at com.sun.proxy.$Proxy55.beforeExecute(Unknown Source)
       at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:47)
       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
       at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
       at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
       at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
       at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:44)
       at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:325)
       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:318)
       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:304)
       at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
       at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
       at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
       at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
       at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
       at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
       at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
       at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalAccessError: tried to access field org.gradle.api.tasks.SourceTask.source from class com.github.sherter.googlejavaformatgradleplugin.FormatTask
       at com.github.sherter.googlejavaformatgradleplugin.FormatTask.hasSources(FormatTask.java:12)
       at com.github.sherter.googlejavaformatgradleplugin.TaskConfigurator.configureFormatTask(TaskConfigurator.java:22)
       at com.github.sherter.googlejavaformatgradleplugin.TaskConfigurator.configure(TaskConfigurator.java:34)
       at com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormat.accept(GoogleJavaFormat.groovy:24)
       at com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormatPlugin$_apply_closure1.doCall(GoogleJavaFormatPlugin.groovy:41)
       at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
       at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
       at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
       at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
       at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
       at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
       ... 26 more

#```

Can anybody help me?

HelloException sample fails on Windows

HelloException fails on Windows platform with the following stacktrace

Exception in thread "main" com.uber.cadence.converter.DataConverterException: when parsing:"{"workflowExecution":{"workflowId":"ba15f8ca-160d-3e37-a53a-ea0a055e874f","runId":"98124ba6-1d8b-404f-a64c-21764b345be6"},"workflowType":{"n
ame":"GreetingChild::composeGreeting"},"eventId":10,"detailMessage":"when parsing:\"{\"activityType\":{\"name\":\"G" into following types: [class com.uber.cadence.workflow.ChildWorkflowFailureException]
        at com.uber.cadence.converter.JsonDataConverter.fromData(JsonDataConverter.java:163)
        at com.uber.cadence.internal.sync.WorkflowStubImpl.mapToWorkflowFailureException(WorkflowStubImpl.java:263)
        at com.uber.cadence.internal.sync.WorkflowStubImpl.getResult(WorkflowStubImpl.java:194)
        at com.uber.cadence.internal.sync.WorkflowStubImpl.getResult(WorkflowStubImpl.java:162)
        at com.uber.cadence.internal.sync.WorkflowInvocationHandler.startWorkflow(WorkflowInvocationHandler.java:246)
        at com.uber.cadence.internal.sync.WorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:183)
        at com.sun.proxy.$Proxy3.getGreeting(Unknown Source)
        at com.uber.cadence.samples.hello.HelloException.main(HelloException.java:177)
Caused by: java.lang.NullPointerException: stackTrace[0]
        at java.base/java.lang.Throwable.setStackTrace(Unknown Source)
        at com.uber.cadence.converter.JsonDataConverter$ThrowableTypeAdapterFactory$3.read(JsonDataConverter.java:334)
        at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:285)
        at com.uber.cadence.converter.JsonDataConverter$ThrowableTypeAdapterFactory$3.read(JsonDataConverter.java:333)
        at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:285)
        at com.uber.cadence.converter.JsonDataConverter$ThrowableTypeAdapterFactory$3.read(JsonDataConverter.java:333)
        at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at com.google.gson.Gson.fromJson(Gson.java:841)
        at com.uber.cadence.converter.JsonDataConverter.fromData(JsonDataConverter.java:161)
        ... 7 more

Distributed samples

Hello,

It would be nice to have distributed examples with java because it is the normal case in production environment, with loose coupling between workers activities, workers workflows, starters and the cadence service. One basic example that demontrate this capability should be nice. Currently all the samples are running in the same main method so it is not clear how to distribute the cadence components.

Thanks

Cant build samples in mac

Here is the output

➜  cadence-java-samples git:(master) ./gradlew build

> Task :test

com.uber.cadence.samples.fileprocessing.FileProcessingTest > testHappyPath FAILED
    org.junit.runners.model.TestTimedOutException at FileProcessingTest.java:100

com.uber.cadence.samples.fileprocessing.FileProcessingTest > testHostFailover FAILED
    org.junit.runners.model.TestTimedOutException at FileProcessingTest.java:100

20 tests completed, 2 failed


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/joe.cabezas/dev/cadence-java-samples/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 28s
7 actionable tasks: 3 executed, 4 up-to-date
➜  cadence-java-samples git:(master) uname -a
Darwin joe-cabezas 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
➜  cadence-java-samples git:(master) sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.3
BuildVersion:	18D109

What I am missing here?, code seems ok, seems mac related

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.