Skip to content

Commit ea146ac

Browse files
committed
feat(dataconverter): add compression, encryption, and S3 offload samples
Add a new package with three production-ready custom implementations following the take-and-go layout: gzip compression, AES-256-GCM encryption, and an S3 / claim-check offload pattern (with a zero-config local-filesystem default and a commented AWS SDK v2 stub). One worker hosts all three on three task lists and prints per-sample stats banners on startup. Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
1 parent 4da7461 commit ea146ac

17 files changed

Lines changed: 2010 additions & 0 deletions

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ These samples demonstrate various capabilities of Java Cadence client and server
2929

3030
* **Custom Workflow Controls** ([`com.uber.cadence.samples.query`](src/main/java/com/uber/cadence/samples/query/)) — workflow queries that return **markdown** for Cadence Web (Markdoc buttons that **signal** workflows or **start** new workflows). **Requires Cadence Web v4.0.14+.** Copy-paste run instructions: [query samples README](src/main/java/com/uber/cadence/samples/query/README.md).
3131

32+
* **DataConverter Samples** ([`com.uber.cadence.samples.dataconverter`](src/main/java/com/uber/cadence/samples/dataconverter/)) — three production-ready custom `DataConverter` patterns (gzip compression, AES-256-GCM encryption, and S3 / claim-check offload) that transparently transform every workflow input, output, and activity parameter. Copy-paste run instructions: [dataconverter samples README](src/main/java/com/uber/cadence/samples/dataconverter/README.md).
33+
3234
## Get the Samples
3335

3436
Run the following commands:
@@ -139,6 +141,20 @@ Starters (pick one per run):
139141

140142
In Cadence Web, open the workflow → **Query** tab → run query **`Signal`**, **`options`**, or **`dashboard`** (matching the starter you used).
141143

144+
### DataConverter Samples
145+
146+
Three samples (compression, encryption, S3 offload) demonstrating custom `DataConverter` implementations. One worker hosts all three on three task lists. See [src/main/java/com/uber/cadence/samples/dataconverter/README.md](src/main/java/com/uber/cadence/samples/dataconverter/README.md) for full details, encryption-key configuration, and S3 swap instructions.
147+
148+
Worker (hosts all three samples; prints per-sample stats banners on startup):
149+
150+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.dataconverter.DataConverterWorker
151+
152+
Starters (pick one per run; each starts a new workflow execution and exits):
153+
154+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.dataconverter.CompressionStarter
155+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.dataconverter.EncryptionStarter
156+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.dataconverter.S3OffloadStarter
157+
142158
### Trip Booking
143159

144160
Cadence implementation of the [Camunda BPMN trip booking example](https://github.com/berndruecker/trip-booking-saga-java)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Modifications copyright (C) 2017 Uber Technologies, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
7+
* use this file except in compliance with the License. A copy of the License is
8+
* located at
9+
*
10+
* http://aws.amazon.com/apache2.0
11+
*
12+
* or in the "license" file accompanying this file. This file is distributed on
13+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14+
* express or implied. See the License for the specific language governing
15+
* permissions and limitations under the License.
16+
*/
17+
18+
package com.uber.cadence.samples.dataconverter;
19+
20+
import java.io.IOException;
21+
22+
/**
23+
* Abstraction over any external object store (local filesystem, S3, GCS, etc.).
24+
*
25+
* <p>{@link S3OffloadDataConverter} uses this interface to store large payloads outside Cadence
26+
* history. The default implementation is {@link LocalFsBlobStore}, which writes to the system
27+
* temporary directory and requires no external services.
28+
*/
29+
public interface BlobStore {
30+
31+
/** Stores {@code data} under {@code key}, overwriting any existing value. */
32+
void put(String key, byte[] data) throws IOException;
33+
34+
/** Returns the bytes previously stored under {@code key}. */
35+
byte[] get(String key) throws IOException;
36+
}

0 commit comments

Comments
 (0)