Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/parallel-examples-probe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# TEMPORARY probe — validates the full 17-README parallel run on one shared dapr
# runtime and self-reports failures as annotations. Removed once green; not for master.
name: Parallel Examples Probe

on:
workflow_dispatch:
push:
branches:
- users/svegiraju/parallel-examples-probe

jobs:
probe:
runs-on: ubuntu-latest
timeout-minutes: 40
env:
JDK_VER: 17
DAPR_CLI_VER: 1.18.0
DAPR_RUNTIME_VER: 1.18.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.18.0/install/install.sh
steps:
- uses: actions/checkout@v7
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Check Docker version
run: docker version
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
- name: Uninstall any existing Dapr
run: dapr uninstall --all || true
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
run: dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
- name: Verify scheduler is listening
run: sleep 20 && docker logs dapr_scheduler && nc -vz localhost 50006
- name: Install mechanical-markdown
run: |
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
pip3 install setuptools wheel
pip3 install mechanical-markdown
- name: Build SDK + examples jar
run: ./mvnw -pl examples -am clean install -B -q -DskipTests
- name: Static parallel-safety check (all 17 READMEs)
run: bash examples/validate/check-parallel-safe.sh
- name: Sequential baseline (-j 1, all 17)
run: |
echo "::group::sequential"
time bash examples/validate/run-parallel.sh -j 1
echo "::endgroup::"
- name: Parallel run on one shared runtime (-j 2, all 17)
run: |
set +e
echo "::group::parallel"
time bash examples/validate/run-parallel.sh -j 2 2>&1 | tee /tmp/par.out
rc=${PIPESTATUS[0]}
echo "::endgroup::"
if [ "$rc" -ne 0 ]; then
echo "---- parallel failures (as annotations) ----"
grep -nE "^ FAIL |Caused by|ALREADY_EXISTS|signal: killed|error code|Exception|is not found|DAPR_|Reason:" /tmp/par.out | head -40 | while IFS= read -r line; do
echo "::error::$line"
done
fi
exit "$rc"
20 changes: 3 additions & 17 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,8 @@ jobs:
retry_wait_seconds: 10
command: |
set -e
(cd examples && mm.py ./src/main/java/io/dapr/examples/crypto/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/workflows/README.md)
# Example READMEs run concurrently against one shared Dapr runtime via the
# parallel-safe runner examples/validate/run-parallel.sh.
bash examples/validate/run-parallel.sh -j 2
(cd spring-boot-examples && mm.py README.md)
(cd spring-boot-examples/workflows/patterns && mm.py README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/jobs/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/conversation/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/invoke/http/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/invoke/grpc/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/tracing/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/exception/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/state/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/pubsub/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/bindings/http/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/secrets/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/unittesting/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/configuration/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/actors/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/querystate/README.md)
(cd examples && mm.py ./src/main/java/io/dapr/examples/pubsub/stream/README.md)
14 changes: 10 additions & 4 deletions examples/components/pubsub/redis_messagebus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ spec:
value: localhost:6379
- name: redisPassword
value: ""
# NOTE: this pubsub component is scoped to specific app-ids. When an example's
# app-id is renamed for parallel-safe validation, the matching scope entry MUST
# be renamed too, or Dapr reports "pubsub messagebus is not found" for that app.
# Shared by the pubsub and pubsub/stream examples — keep both examples' app-ids here.
scopes:
- publisher
- bulk-publisher
- subscriber
- publisher-tracing
- pubsub-publisher
- pubsub-bulk-publisher
- pubsub-subscriber
- pubsub-publisher-tracing
- pubsub-stream-subscriber
- pubsub-stream-publisher
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/actors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ timeout_seconds: 90

Now, execute the following script in order to run DemoActorService:
```sh
dapr run --resources-path ./components/actors --app-id demoactorservice --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorService -p 3000
dapr run --resources-path ./components/actors --app-id actors-demoactorservice --app-port 3100 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorService -p 3100
```
<!-- END_STEP -->
### Running the Actor client
Expand Down Expand Up @@ -252,7 +252,7 @@ timeout_seconds: 45


```sh
dapr run --resources-path ./components/actors --app-id demoactorclient -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorClient
dapr run --resources-path ./components/actors --app-id actors-demoactorclient -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorClient
```

<!-- END_STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ sleep: 10
-->

```bash
dapr run --resources-path ./components/bindings --app-id inputbinding --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3000
dapr run --resources-path ./components/bindings --app-id bindings-http-inputbinding --app-port 3120 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3120
```

<!-- END_STEP -->
Expand Down Expand Up @@ -209,7 +209,7 @@ sleep: 30
-->

```bash
dapr run --resources-path ./components/bindings --app-id outputbinding -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample
dapr run --resources-path ./components/bindings --app-id bindings-http-outputbinding -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample
```

<!-- END_STEP -->
Expand Down Expand Up @@ -249,8 +249,8 @@ name: Cleanup apps
-->

```bash
dapr stop --app-id inputbinding
dapr stop --app-id outputbinding
dapr stop --app-id bindings-http-inputbinding
dapr stop --app-id bindings-http-outputbinding
```

<!-- END_STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ sleep: 10
-->

```bash
dapr run --resources-path ./components/configuration --app-id configgrpc --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.configuration.ConfigurationClient
dapr run --resources-path ./components/configuration --app-id configuration-configgrpc --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.configuration.ConfigurationClient
```

<!-- END_STEP -->
Expand All @@ -185,7 +185,7 @@ name: Cleanup
-->

```bash
dapr stop --app-id configgrpc
dapr stop --app-id configuration-configgrpc
```

<!-- END_STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ sleep: 10
-->

```bash
dapr run --resources-path ./components/conversation --app-id myapp --app-port 8080 --dapr-http-port 3500 --dapr-grpc-port 51439 --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.conversation.UserMessageDemo
dapr run --resources-path ./components/conversation --app-id conversation-myapp --app-port 3160 --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.conversation.UserMessageDemo
```

<!-- END_STEP -->
Expand All @@ -128,7 +128,7 @@ name: Cleanup
-->

```bash
dapr stop --app-id myapp
dapr stop --app-id conversation-myapp
```

<!-- END_STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public static void main(String[] args) throws Exception {
generateKeysIfNeeded();

Map<Property<?>, String> overrides = Map.of(
Properties.HTTP_PORT, "3500",
Properties.GRPC_PORT, "50001"
Properties.HTTP_PORT, "3180",
Properties.GRPC_PORT, "3181"
);

try (DaprPreviewClient client = new DaprClientBuilder().withPropertyOverrides(overrides).buildPreviewClient()) {
Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ sleep: 30
-->

```bash
dapr run --resources-path ./components/crypto --app-id crypto-app --dapr-http-port 3500 --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.crypto.CryptoExample
dapr run --resources-path ./components/crypto --app-id crypto-app --dapr-http-port 3180 --dapr-grpc-port 3181 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.crypto.CryptoExample
```

<!-- END_STEP -->
Expand All @@ -130,7 +130,7 @@ dapr run --resources-path ./components/crypto --app-id crypto-app --dapr-http-po
- Custom encryption ciphers

```bash
dapr run --resources-path ./components/crypto --app-id crypto-app --dapr-http-port 3500 --dapr-grpc-port 50001 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.crypto.StreamingCryptoExample
dapr run --resources-path ./components/crypto --app-id crypto-app --dapr-http-port 3180 --dapr-grpc-port 3181 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.crypto.StreamingCryptoExample
```

### Sample Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public static void main(String[] args) throws Exception {
generateKeysIfNeeded();

Map<Property<?>, String> overrides = Map.of(
Properties.HTTP_PORT, "3500",
Properties.GRPC_PORT, "50001"
Properties.HTTP_PORT, "3180",
Properties.GRPC_PORT, "3181"
);

try (DaprPreviewClient client = new DaprClientBuilder().withPropertyOverrides(overrides).buildPreviewClient()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void main(String[] args) throws Exception {
String user = "World";
try (DaprClient client = new DaprClientBuilder().build()) {
HelloWorldGrpc.HelloWorldBlockingStub blockingStub = client.newGrpcStub(
"hellogrpc",
"invoke-grpc-hellogrpc",
channel -> HelloWorldGrpc.newBlockingStub(channel));

logger.info("Will try to greet " + user + " ...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sleep: 1
-->

```bash
dapr run --app-id hellogrpc --app-port 5000 --app-protocol grpc -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldService -p 5000
dapr run --app-id invoke-grpc-hellogrpc --app-port 3220 --app-protocol grpc -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldService -p 3220
```

<!-- END_STEP -->
Expand Down Expand Up @@ -131,7 +131,7 @@ sleep: 10
-->

```bash
dapr run --app-id invokegrpc --app-protocol grpc -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
dapr run --app-id invoke-grpc-invokegrpc --app-protocol grpc -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
```

<!-- END_STEP -->
Expand All @@ -145,8 +145,8 @@ name: Cleanup
-->

```bash
dapr stop --app-id hellogrpc
dapr stop --app-id invokegrpc
dapr stop --app-id invoke-grpc-hellogrpc
dapr stop --app-id invoke-grpc-invokegrpc
```

<!-- END_STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class InvokeClient {
/**
* Identifier in Dapr for the service this client will invoke.
*/
private static final String SERVICE_APP_ID = "invokedemo";
private static final String SERVICE_APP_ID = "invoke-http-invokedemo";

/**
* Method on the target service to invoke.
Expand Down
10 changes: 5 additions & 5 deletions examples/src/main/java/io/dapr/examples/invoke/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ sleep: 5
-->

```sh
dapr run --app-id invokedemo --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.DemoService -p 3000
dapr run --app-id invoke-http-invokedemo --app-port 3240 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.DemoService -p 3240
```

<!-- END_STEP -->
Expand All @@ -145,7 +145,7 @@ In `InvokeClient.java` file, you will find the `InvokeClient` class and the `mai
```java
public class InvokeClient {

private static final String SERVICE_APP_ID = "invokedemo";
private static final String SERVICE_APP_ID = "invoke-http-invokedemo";
private static final String METHOD = "say";

public static void main(String[] args) throws Exception {
Expand Down Expand Up @@ -197,7 +197,7 @@ sleep: 5
-->

```sh
dapr run --app-id invokeclient -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient "message one" "message two"
dapr run --app-id invoke-http-invokeclient -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient "message one" "message two"
```

<!-- END_STEP -->
Expand All @@ -223,8 +223,8 @@ name: Cleanup
-->

```bash
dapr stop --app-id invokedemo
dapr stop --app-id invokeclient
dapr stop --app-id invoke-http-invokedemo
dapr stop --app-id invoke-http-invokeclient
```

<!-- END_STEP -->
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.dapr.client.DaprClient;
import io.dapr.client.DaprClientBuilder;
import io.dapr.client.DaprPreviewClient;
import io.dapr.client.domain.DeleteJobRequest;
import io.dapr.client.domain.GetJobRequest;
import io.dapr.client.domain.GetJobResponse;
import io.dapr.client.domain.JobSchedule;
Expand All @@ -32,12 +33,20 @@ public class DemoJobsClient {
*/
public static void main(String[] args) throws Exception {
Map<Property<?>, String> overrides = Map.of(
Properties.HTTP_PORT, "3500",
Properties.GRPC_PORT, "51439"
Properties.HTTP_PORT, "3261",
Properties.GRPC_PORT, "3262"
);

try (DaprClient client = new DaprClientBuilder().withPropertyOverrides(overrides).build()) {

// The scheduler persists this recurring job across runs, so delete any
// pre-existing instance first to keep the example idempotent / re-runnable.
try {
client.deleteJob(new DeleteJobRequest("dapr-job-1")).block();
} catch (Exception e) {
System.out.println("No existing 'dapr-job-1' to delete (first run): " + e.getMessage());
}

// Schedule a job.
System.out.println("**** Scheduling a Job with name dapr-jobs-1 *****");
ScheduleJobRequest scheduleJobRequest = new ScheduleJobRequest("dapr-job-1",
Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/jobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ sleep: 10
-->

```bash
dapr run --resources-path ./components/configuration --app-id myapp --app-port 8080 --dapr-http-port 3500 --dapr-grpc-port 51439 --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.jobs.DemoJobsSpringApplication
dapr run --resources-path ./components/configuration --app-id jobs-myapp --app-port 3260 --dapr-http-port 3261 --dapr-grpc-port 3262 --log-level debug -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.jobs.DemoJobsSpringApplication --server.port=3260
```

```bash
Expand All @@ -127,7 +127,7 @@ name: Cleanup
-->

```bash
dapr stop --app-id myapp
dapr stop --app-id jobs-myapp
```

<!-- END_STEP -->
Expand Down
Loading
Loading