Skip to content

Commit 235f487

Browse files
committed
Merge remote-tracking branch 'core/main' into taskinteraction__
2 parents db5e3b8 + d6629ab commit 235f487

190 files changed

Lines changed: 8700 additions & 2305 deletions

File tree

Some content is hidden

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

.buildkite/pipeline.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Continuous Integration"
2+
on: [push, pull_request]
3+
4+
jobs:
5+
validation:
6+
name: "Gradle wrapper validation"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: gradle/wrapper-validation-action@v3
11+
12+
unittest:
13+
name: Unit Tests
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
steps:
17+
- name: Checkout repo
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
submodules: recursive
22+
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Run unit tests
25+
run: |
26+
docker compose -f ./docker/github/docker-compose.yaml up unit-test
27+
28+
copyright:
29+
name: Copyright and code format
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 20
32+
steps:
33+
- name: Checkout repo
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
submodules: recursive
38+
ref: ${{ github.event.pull_request.head.sha }}
39+
40+
- name: Set up Java
41+
uses: actions/setup-java@v4
42+
with:
43+
java-version: "11"
44+
distribution: "temurin"
45+
46+
- name: Set up Gradle
47+
uses: gradle/actions/setup-gradle@v3
48+
49+
- name: Run copyright and code format checks
50+
run: ./gradlew --no-daemon checkLicenseMain checkLicenses spotlessCheck

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
4848
#### Hello samples
4949

5050
- [**Hello**](/core/src/main/java/io/temporal/samples/hello): This sample includes a number of individual Workflows that can be executed independently. Each one demonstrates something specific.
51+
52+
- [**HelloAccumulator**](/core/src/main/java/io/temporal/samples/hello/HelloAccumulator.java): Demonstrates a Workflow Definition that accumulates signals and continues as new.
5153
- [**HelloActivity**](/core/src/main/java/io/temporal/samples/hello/HelloActivity.java): Demonstrates a Workflow Definition that executes a single Activity.
5254
- [**HelloActivityRetry**](/core/src/main/java/io/temporal/samples/hello/HelloActivityRetry.java): Demonstrates how to Retry an Activity Execution.
5355
- [**HelloActivityExclusiveChoice**](/core/src/main/java/io/temporal/samples/hello/HelloActivityExclusiveChoice.java): Demonstrates how to execute Activities based on dynamic input.
@@ -62,6 +64,7 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
6264
- [**HelloChild**](/core/src/main/java/io/temporal/samples/hello/HelloChild.java): Demonstrates how to execute a simple Child Workflow.
6365
- [**HelloCron**](/core/src/main/java/io/temporal/samples/hello/HelloCron.java): Demonstrates how to execute a Workflow according to a cron schedule.
6466
- [**HelloDynamic**](/core/src/main/java/io/temporal/samples/hello/HelloDynamic.java): Demonstrates how to use `DynamicWorkflow` and `DynamicActivity` interfaces.
67+
- [**HelloEagerWorkflowStart**](/core/src/main/java/io/temporal/samples/hello/HelloEagerWorkflowStart.java): Demonstrates the use of a eager workflow start.
6568
- [**HelloPeriodic**](/core/src/main/java/io/temporal/samples/hello/HelloPeriodic.java): Demonstrates the use of the Continue-As-New feature.
6669
- [**HelloException**](/core/src/main/java/io/temporal/samples/hello/HelloException.java): Demonstrates how to handle exception propagation and wrapping.
6770
- [**HelloLocalActivity**](/core/src/main/java/io/temporal/samples/hello/HelloLocalActivity.java): Demonstrates the use of a [Local Activity](https://docs.temporal.io/docs/jargon/mesh/#local-activity).
@@ -75,6 +78,7 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
7578
- [**HelloUpdate**](/core/src/main/java/io/temporal/samples/hello/HelloUpdate.java): Demonstrates how to create and interact with an Update.
7679
- [**HelloDelayedStart**](/core/src/main/java/io/temporal/samples/hello/HelloDelayedStart.java): Demonstrates how to use delayed start config option when starting a Workflow Executions.
7780
- [**HelloSignalWithTimer**](/core/src/main/java/io/temporal/samples/hello/HelloSignalWithTimer.java): Demonstrates how to use collect signals for certain amount of time and then process last one.
81+
- [**HelloWorkflowTimer**](/core/src/main/java/io/temporal/samples/hello/HelloWorkflowTimer.java): Demonstrates how we can use workflow timer to restrict duration of workflow execution instead of workflow run/execution timeouts.
7882

7983

8084
#### Scenario-based samples
@@ -83,11 +87,13 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
8387

8488
- [**Booking SAGA**](/core/src/main/java/io/temporal/samples/bookingsaga): Demonstrates Temporals take on the Camunda BPMN "trip booking" example.
8589

90+
- [**Synchronous Booking SAGA**](/core/src/main/java/io/temporal/samples/bookingsyncsaga): Demonstrates low latency SAGA with potentially long compensations.
91+
8692
- [**Money Transfer**](/core/src/main/java/io/temporal/samples/moneytransfer): Demonstrates the use of a dedicated Activity Worker.
8793

8894
- [**Money Batch**](/core/src/main/java/io/temporal/samples/moneybatch): Demonstrates a situation where a single deposit should be initiated for multiple withdrawals. For example, a seller might want to be paid once per fixed number of transactions. This sample can be easily extended to perform a payment based on more complex criteria, such as at a specific time or an accumulated amount. The sample also demonstrates how to Signal the Workflow when it executes (*Signal with start*). If the Workflow is already executing, it just receives the Signal. If it is not executing, then the Workflow executes first, and then the Signal is delivered to it. *Signal with start* is a "lazy" way to execute Workflows when Signaling them.
8995

90-
- [**Customer Application Approval DSL**](/core/src/main/java/io/temporal/samples/dsl): Demonstrates execution of a customer application approval workflow defined in a DSL (like JSON or YAML)
96+
- [**Domain-Specific-Language - Define sequence of steps in JSON**](/core/src/main/java/io/temporal/samples/dsl): Demonstrates using domain specific language (DSL) defined in JSON to specify sequence of steps to be performed in our workflow.
9197

9298
- [**Polling Services**](/core/src/main/java/io/temporal/samples/polling): Recommended implementation of an activity that needs to periodically poll an external resource waiting its successful completion
9399

@@ -97,14 +103,16 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
97103

98104
- [**Sliding Window Batch**](/core/src/main/java/io/temporal/samples/batch/slidingwindow): A batch implementation that maintains a configured number of child workflows during processing.
99105

106+
- [**Safe Message Passing**](/core/src/main/java/io/temporal/samples/safemessagepassing): Safely handling concurrent updates and signals messages.
107+
100108
#### API demonstrations
101109

102110
- [**Async Untyped Child Workflow**](/core/src/main/java/io/temporal/samples/asyncuntypedchild): Demonstrates how to invoke an untyped child workflow async, that can complete after parent workflow is already completed.
103111

104112
- [**Updatable Timer**](/core/src/main/java/io/temporal/samples/updatabletimer): Demonstrates the use of a helper class which relies on `Workflow.await` to implement a blocking sleep that can be updated at any moment.
105113

106114
- [**Workflow Count Interceptor**](/core/src/main/java/io/temporal/samples/countinterceptor): Demonstrates how to create and register a simple Workflow Count Interceptor.
107-
-
115+
108116
- [**Workflow Retry On Signal Interceptor**](/core/src/main/java/io/temporal/samples/retryonsignalinterceptor): Demonstrates how to create and register an interceptor that retries an activity on a signal.
109117

110118
- [**List Workflows**](/core/src/main/java/io/temporal/samples/listworkflows): Demonstrates the use of custom search attributes and ListWorkflowExecutionsRequest with custom queries.
@@ -125,6 +133,8 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
125133

126134
- [**Payload Codec**](/core/src/main/java/io/temporal/samples/encodefailures): Demonstrates how to use simple codec to encode/decode failure messages.
127135

136+
- [**Exclude Workflow/ActivityTypes from Interceptors**](/core/src/main/java/io/temporal/samples/excludefrominterceptor): Demonstrates how to exclude certain workflow / activity types from interceptors.
137+
128138
#### SDK Metrics
129139

130140
- [**Set up SDK metrics**](/core/src/main/java/io/temporal/samples/metrics): Demonstrates how to set up and scrape SDK metrics.
@@ -133,6 +143,19 @@ See the README.md file in each main sample directory for cut/paste Gradle comman
133143

134144
- [**Set up OpenTracing and/or OpenTelemetry with Jaeger**](/core/src/main/java/io/temporal/samples/tracing): Demonstrates how to set up OpenTracing and/or OpenTelemetry and view traces using Jaeger.
135145

146+
#### Encryption Support
147+
148+
- [**Encrypted Payloads**](/core/src/main/java/io/temporal/samples/encryptedpayloads): Demonstrates how to use simple codec to encrypt and decrypt payloads.
149+
150+
- [**AWS Encryption SDK**](/core/src/main/java/io/temporal/samples/keymanagementencryption/awsencryptionsdk): Demonstrates how to use the AWS Encryption SDK to encrypt and decrypt payloads with AWS KMS.
151+
152+
#### Nexus Samples
153+
154+
- [**Getting Started**](/core/src/main/java/io/temporal/samples/nexus): Demonstrates how to get started with Temporal and Nexus.
155+
156+
- [**Cancellation**](/core/src/main/java/io/temporal/samples/nexuscancellation): Demonstrates how to cancel an async Nexus operation.
157+
158+
- [**Context/Header Propagation**](/core/src/main/java/io/temporal/samples/nexuscontextpropagation): Demonstrates how to propagate context through Nexus operation headers.
136159

137160
<!-- @@@SNIPEND -->
138161

@@ -161,6 +184,7 @@ More info on each sample:
161184
- [**Kafka Request / Reply**](/springboot/src/main/java/io/temporal/samples/springboot/kafka): Sample showing possible integration with event streaming platforms such as Kafka
162185
- [**Customize Options**](/springboot/src/main/java/io/temporal/samples/springboot/customize): Sample showing how to customize options such as WorkerOptions, WorkerFactoryOptions, etc (see options config [here](springboot/src/main/java/io/temporal/samples/springboot/customize/TemporalOptionsConfig.java))
163186
- [**Apache Camel Route**](/springboot/src/main/java/io/temporal/samples/springboot/camel): Sample showing how to start Workflow execution from a Camel Route
187+
- [**Custom Actuator Endpoint**](/springboot/src/main/java/io/temporal/samples/springboot/actuator): Sample showing how to create a custom Actuator endpoint that shows registered Workflow and Activity impls per task queue.
164188

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

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'org.cadixdev.licenser' version '0.6.1'
3-
id "net.ltgt.errorprone" version "3.1.0"
3+
id "net.ltgt.errorprone" version "4.0.1"
44
id 'com.diffplug.spotless' version '6.25.0' apply false
55
id "org.springframework.boot" version "${springBootPluginVersion}"
66
}
@@ -28,7 +28,7 @@ subprojects {
2828
ext {
2929
otelVersion = '1.30.1'
3030
otelVersionAlpha = "${otelVersion}-alpha"
31-
javaSDKVersion = '1.23.1'
31+
javaSDKVersion = '1.28.1'
3232
camelVersion = '3.22.1'
3333
jarVersion = '1.0.0'
3434
}
@@ -59,7 +59,7 @@ subprojects {
5959
java {
6060
target 'src/*/java/**/*.java'
6161
targetExclude '**/.idea/**'
62-
googleJavaFormat('1.16.0')
62+
googleJavaFormat('1.24.0')
6363
}
6464
}
6565

core/build.gradle

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ dependencies {
55
testImplementation("io.temporal:temporal-testing:$javaSDKVersion")
66

77
// Needed for SDK related functionality
8-
implementation(platform("com.fasterxml.jackson:jackson-bom:2.17.0"))
8+
implementation(platform("com.fasterxml.jackson:jackson-bom:2.17.2"))
99
implementation "com.fasterxml.jackson.core:jackson-databind"
1010
implementation "com.fasterxml.jackson.core:jackson-core"
1111

1212
implementation "io.micrometer:micrometer-registry-prometheus"
1313

14-
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.3'
14+
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.6'
1515
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.9.0'
1616

1717
implementation(platform("io.opentelemetry:opentelemetry-bom:$otelVersion"))
@@ -24,29 +24,33 @@ dependencies {
2424

2525
// Used in samples
2626
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
27-
implementation group: 'io.cloudevents', name: 'cloudevents-core', version: '2.5.0'
28-
implementation group: 'io.cloudevents', name: 'cloudevents-api', version: '2.5.0'
29-
implementation group: 'io.cloudevents', name: 'cloudevents-json-jackson', version: '2.5.0'
30-
implementation group: 'io.serverlessworkflow', name: 'serverlessworkflow-api', version: '4.0.5.Final'
31-
implementation group: 'io.serverlessworkflow', name: 'serverlessworkflow-validation', version: '4.0.5.Final'
32-
implementation group: 'io.serverlessworkflow', name: 'serverlessworkflow-spi', version: '4.0.5.Final'
33-
implementation group: 'io.serverlessworkflow', name: 'serverlessworkflow-util', version: '4.0.5.Final'
27+
implementation group: 'io.cloudevents', name: 'cloudevents-core', version: '4.0.1'
28+
implementation group: 'io.cloudevents', name: 'cloudevents-api', version: '4.0.1'
29+
implementation group: 'io.cloudevents', name: 'cloudevents-json-jackson', version: '3.0.0'
3430
implementation group: 'net.thisptr', name: 'jackson-jq', version: '1.0.0-preview.20240207'
31+
implementation group: 'commons-cli', name: 'commons-cli', version: '1.9.0'
32+
33+
// Used in AWS Encryption SDK sample
34+
implementation group: 'com.amazonaws', name: 'aws-encryption-sdk-java', version: '3.0.1'
35+
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.2")
36+
implementation(platform("software.amazon.awssdk:bom:2.20.91"))
37+
implementation("software.amazon.awssdk:kms")
38+
implementation("software.amazon.awssdk:dynamodb")
3539

3640
// we don't update it to 2.1.0 because 2.1.0 requires Java 11
3741
implementation 'com.codingrodent:jackson-json-crypto:1.1.0'
3842

3943
testImplementation "junit:junit:4.13.2"
40-
testImplementation "org.mockito:mockito-core:5.11.0"
44+
testImplementation "org.mockito:mockito-core:5.12.0"
4145

42-
testImplementation(platform("org.junit:junit-bom:5.10.2"))
46+
testImplementation(platform("org.junit:junit-bom:5.10.3"))
4347
testImplementation "org.junit.jupiter:junit-jupiter-api"
4448
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
4549
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
4650

4751
dependencies {
4852
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
49-
errorprone('com.google.errorprone:error_prone_core:2.26.1')
53+
errorprone('com.google.errorprone:error_prone_core:2.28.0')
5054
}
5155
}
5256

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
3+
*
4+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
*
6+
* Modifications copyright (C) 2017 Uber Technologies, Inc.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
9+
* use this file except in compliance with the License. A copy of the License is
10+
* located at
11+
*
12+
* http://aws.amazon.com/apache2.0
13+
*
14+
* or in the "license" file accompanying this file. This file is distributed on
15+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
16+
* express or implied. See the License for the specific language governing
17+
* permissions and limitations under the License.
18+
*/
19+
20+
package io.temporal.samples.bookingsaga;
21+
22+
public final class Booking {
23+
private String carReservationID;
24+
private String hotelReservationID;
25+
private String flightReservationID;
26+
27+
/** Empty constructor to keep Jackson serializer happy. */
28+
public Booking() {}
29+
30+
public Booking(String carReservationID, String hotelReservationID, String flightReservationID) {
31+
this.carReservationID = carReservationID;
32+
this.hotelReservationID = hotelReservationID;
33+
this.flightReservationID = flightReservationID;
34+
}
35+
36+
public String getCarReservationID() {
37+
return carReservationID;
38+
}
39+
40+
public String getHotelReservationID() {
41+
return hotelReservationID;
42+
}
43+
44+
public String getFlightReservationID() {
45+
return flightReservationID;
46+
}
47+
48+
@Override
49+
public String toString() {
50+
return "Booking{"
51+
+ "carReservationID='"
52+
+ carReservationID
53+
+ '\''
54+
+ ", hotelReservationID='"
55+
+ hotelReservationID
56+
+ '\''
57+
+ ", flightReservationID='"
58+
+ flightReservationID
59+
+ '\''
60+
+ '}';
61+
}
62+
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
## Saga example: trip booking
22

3-
Temporal implementation of the [Camunda BPMN trip booking example](https://github.com/berndruecker/trip-booking-saga-java) which demonstrates Temporal approach to SAGA.
3+
Temporal implementation of
4+
the [Camunda BPMN trip booking example](https://github.com/berndruecker/trip-booking-saga-java) which demonstrates
5+
Temporal approach to SAGA.
46

57
Run the following command to start the sample:
68

79
```bash
810
./gradlew -q execute -PmainClass=io.temporal.samples.bookingsaga.TripBookingSaga
911
```
1012

11-
Sample unit testing: [TripBookingWorkflowTest](https://github.com/temporalio/samples-java/blob/main/src/test/java/io/temporal/samples/bookingsaga/TripBookingWorkflowTest.java)
13+
Note that the booking is expected to fail to demonstrate the compensation flow.
14+
15+
Sample unit
16+
testing: [TripBookingWorkflowTest](https://github.com/temporalio/samples-java/blob/main/core/src/test/java/io/temporal/samples/bookingsaga/TripBookingWorkflowTest.java)

0 commit comments

Comments
 (0)