Home

Awesome

Temporal Java SDK Samples

This repository contains samples that demonstrate various capabilities of Temporal using the Java SDK.

It contains two modules:

Learn more about Temporal and Java SDK

Requirements

Build and run tests

  1. Clone this repository:

    git clone https://github.com/temporalio/samples-java
    cd samples-java
    
  2. Build and run Tests

    ./gradlew build
    

Running Samples:

You can run both "Core" and "SpringBoot" samples from the main samples project directory. Details on how to run each sample can be found in following two sections. To skip to SpringBoot samples click here.

Running "Core" samples

See the README.md file in each main sample directory for cut/paste Gradle command to run specific example.

<!-- @@@SNIPSTART samples-java-readme-samples-directory -->

Hello samples

Scenario-based samples

API demonstrations

SDK Metrics

Tracing Support

<!-- @@@SNIPEND -->

Running SpringBoot Samples

These samples use SpringBoot 2 by default. To switch to using SpringBoot 3 look at the gradle.properties file and follow simple instructions there.

  1. Start SpringBoot from main repo dir:

    ./gradlew :springboot:bootRun
    

To run the basic sample run

   ./gradlew :springboot-basic:bootRun

2. Navigate to localhost:3030

  1. Select which sample you want to run

More info on each sample:

Temporal Cloud

To run any of the SpringBoot samples in your Temporal Cloud namespace:

  1. Edit the application-tc.yaml to set your namespace and client certificates.

  2. Start SpringBoot from main repo dir with the tc profile:

    ./gradlew bootRun --args='--spring.profiles.active=tc'
    
  3. Follow the previous section from step 2