Skip to content
Merged
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
File renamed without changes.
13 changes: 13 additions & 0 deletions examples/components/state/redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: actorStateStore
value: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
* Client for Actor runtime to invoke actor methods.
* 1. Build and install jars:
* mvn clean install
* 2. Run the client:
* dapr run --components-path ./components --app-id demoactorclient -- java -jar \
* 2. cd to [repo-root]/examples
* 3. Run the client:
* dapr run --components-path ./components/actors --app-id demoactorclient -- java -jar \
* target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorClient
*/
public class DemoActorClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
* Service for Actor runtime.
* 1. Build and install jars:
* mvn clean install
* 2. Run the server:
* dapr run --components-path ./components --app-id demoactorservice --app-port 3000 \
* 2. cd to [repo-root]/examples
* 3. Run the server:
* dapr run --components-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
*/
public class DemoActorService {
Expand Down
12 changes: 6 additions & 6 deletions examples/src/main/java/io/dapr/examples/actors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The `@ActorType` annotation indicates the Dapr Java SDK that this interface is a

Now, execute the following script in order to run DemoActorService:
```sh
dapr run --components-path ./components --app-id demoactorservice --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorService -p 3000
dapr run --components-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
```

### Running the Actor client
Expand Down Expand Up @@ -190,21 +190,21 @@ Then, the code executes the `callActorForever` private method once per actor. In
Use the follow command to execute the DemoActorClient:

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

Once running, the `DemoActorClient` logs will start displaying the different steps:
First, we can see actors being activated:
![actordemo1](../../../../../../resources/img/demo-actor-client1.png)
![actordemo1](../../../../../resources/img/demo-actor-client1.png)

Then we can see the `registerReminder` in action. `DemoActorClient` console displays the actors handling reminders:
![actordemo2](../../../../../../resources/img/demo-actor-client2.png)
![actordemo2](../../../../../resources/img/demo-actor-client2.png)

After invoking `incrementAndGet`, the code invokes `say` method (you'll see these messages 10 times per each of the 3 actors):
![actordemo2](../../../../../../resources/img/demo-actor-client3.png)
![actordemo2](../../../../../resources/img/demo-actor-client3.png)

On the other hand, the console for `DemoActorService` is also responding to the remote invocations:
![actordemo2](../../../../../../resources/img/demo-actor-service.png)
![actordemo2](../../../../../resources/img/demo-actor-service.png)

For more details on Dapr SpringBoot integration, please refer to [Dapr Spring Boot](../../../springboot/DaprApplication.java) Application implementation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* mvn clean install
* 2. cd to [repo-root]/examples
* 3. Run :
* dapr run --components-path ./components --app-id inputbinding --app-port 3000 --dapr-http-port 3005 \
* -- java -jar target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.bindings.http.InputBindingExample -p 3000
* dapr run --components-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
*/
public class InputBindingExample {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* mvn clean install
* 2. cd to [repo-root]/examples
* 3. Run the program:
* dapr run --components-path ./components --app-id outputbinding --dapr-http-port 3006 \
* dapr run --components-path ./components/bindings --app-id outputbinding \
* -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample
*/
public class OutputBindingExample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class InputBindingController {

Execute the follow script in order to run the Input Binding example:
```sh
dapr run --components-path ./components --app-id inputbinding --app-port 3000 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3000
dapr run --components-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
```

### Running the Output binding sample
Expand Down Expand Up @@ -150,7 +150,7 @@ This example binds two events: A user-defined data object (using the `myClass` o
Use the follow command to execute the Output Binding example:

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

Once running, the OutputBindingExample should print the output as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
* 2. Go into examples:
* cd examples
* 3. send a message to be saved as state:
* dapr run --components-path ./components --dapr-http-port 3006 -- \
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.exception.Client
* dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.exception.Client
*/
public class Client {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The Dapr client is also within a try-with-resource block to properly close the c

Run this example with the following command:
```sh
dapr run --components-path ./components --dapr-http-port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.exception.Client
dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.exception.Client
```
Once running, the OutputBindingExample should print the output as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. cd [repo root]/examples
* 2. Send messages to the server:
* dapr run --components-path ./examples/components -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.invoke.grpc.HelloWorldClient
* dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
*/
public class HelloWorldClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. Run in server mode:
* dapr run --components-path ./components --app-id hellogrpc --app-port 5000 --app-protocol grpc \
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.invoke.grpc.HelloWorldService \
* -p 5000
* 2. cd [repo root]/examples
* 3. Run in server mode:
* 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
*/
public class HelloWorldService {

Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/invoke/grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ In the `GrpcHelloWorldDaprService` class, the `onInvoke` method is the most impo
Now run the service code:

```sh
dapr run --components-path ./components --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 hellogrpc --app-port 5000 --app-protocol grpc -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldService -p 5000
```

The `app-id` argument is used to identify this service in Dapr's runtime. The `app-port` determines which port Dapr's runtime should call into this service. The `protocol` argument informs Dapr which protocol it should use to invoke the application: `grpc` or `http`(default).
Expand Down Expand Up @@ -118,7 +118,7 @@ Finally, it will go through in an infinite loop and invoke the `say` method ever
Finally, open a new command line terminal and run the client code to send some messages.

```sh
dapr run --components-path ./components -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
```

Once the messages are sent, use `CTRL+C` to exit Dapr.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. Run in server mode:
* dapr run --components-path ./components --app-id invokedemo --app-port 3000 --dapr-http-port 3005 \
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.invoke.http.DemoService -p 3000
* 2. cd [repo root]/examples
* 3. Run in server mode:
* 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
*/
public class DemoService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. Send messages to the server:
* dapr run --components-path ./examples/components \
* --dapr-http-port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two'
* 2. cd [repo root]/examples
* 3. Send messages to the server:
* dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two'
*/
public class InvokeClient {

Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/invoke/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class DemoServiceController {
Use the follow command to execute the demo service example:

```sh
dapr run --components-path ./components --app-id invokedemo --app-port 3000 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.DemoService -p 3000
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
```

Once running, the ExposerService is now ready to be invoked by Dapr.
Expand Down Expand Up @@ -131,7 +131,7 @@ The class knows the app id for the remote application. It uses the the static `D

Execute the follow script in order to run the InvokeClient example, passing two messages for the remote method:
```sh
dapr run --components-path ./components --dapr-http-port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient "message one" "message two"
dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient "message one" "message two"
```
Once running, the output should display the messages sent from invoker in the demo service output as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
* Message publisher.
* 1. Build and install jars:
* mvn clean install
* 2. Run the program:
* dapr run --components-path ./components --app-id publisher --dapr-http-port 3006 -- \
* java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
* 2. cd [repo root]/examples
* 3. Run the program:
* dapr run --components-path ./components/pubsub --app-id publisher -- \
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
*/
public class Publisher {

Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/pubsub/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class SubscriberController {
```
Execute the follow script in order to run the Subscriber example:
```sh
dapr run --components-path ./components --app-id subscriber --app-port 3000 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
dapr run --components-path ./components/pubsub --app-id subscriber --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
```

### Running the publisher
Expand Down Expand Up @@ -130,7 +130,7 @@ public class Publisher {
Use the follow command to execute the Publisher example:

```sh
dapr run --components-path ./components --app-id publisher --dapr-http-port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
dapr run --components-path ./components/pubsub --app-id publisher -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
```

Once running, the Publisher should print the output as follows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
* Service for subscriber.
* 1. Build and install jars:
* mvn clean install
* 2. Run the server:
* dapr run --components-path ./components --app-id subscriber --app-port 3000 --dapr-http-port 3005 -- \
* java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
* 2. cd [repo root]/examples
* 3. Run the server:
* dapr run --components-path ./components/pubsub --app-id subscriber --app-port 3000 -- \
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
*/
public class Subscriber {

Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/secrets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The Dapr client is also within a try-with-resource block to properly close the c

Execute the following script in order to run the example:
```sh
dapr run --components-path ./components -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
dapr run --components-path ./components/secrets -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
```

Once running, the program should print the output as follows:
Expand Down Expand Up @@ -165,7 +165,7 @@ The configuration defines, that the only allowed secret is `movie` and all other

Execute the following script in order to run this example with additional secret scoping:
```sh
dapr run --components-path ./components --config ./src/main/java/io/dapr/examples/secrets/config.yaml -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
dapr run --components-path ./components/secrets --config ./src/main/java/io/dapr/examples/secrets/config.yaml -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
```
Once running, the program should print the output as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 3. Add secret to vault:
* vault kv put secret/dapr/movie title="[my favorite movie]"
* 4. Read secret from example:
* dapr run --components-path ./components -- \
* dapr run --components-path ./components/secrets -- \
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
*/
public class SecretClient {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/main/java/io/dapr/examples/state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The Dapr client is also within a try-with-resource block to properly close the c

Run this example with the following command:
```sh
dapr run --components-path ./components --dapr-http-port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
dapr run --components-path ./components/state -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
```
Once running, the OutputBindingExample should print the output as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. send a message to be saved as state:
* dapr run --components-path ./components --dapr-http-port 3006 -- \
* java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.state.StateClient 'my message'
* 2. cd [repo root]/examples
* 3. send a message to be saved as state:
* dapr run --components-path ./components/state -- \
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
*/
public class StateClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
/**
* 1. Build and install jars:
* mvn clean install
* 2. Send messages to the server:
* dapr run --components-path ./examples/components \
* --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.tracing.InvokeClient 'message one' 'message two'
* 2. cd [repo root]/examples
* 3. Send messages to the server:
* dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.tracing.InvokeClient 'message one' 'message two'
*/
public class InvokeClient {

Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/java/io/dapr/examples/tracing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ The instrumentation for the service happens via the `OpenTelemetryIterceptor` cl
Use the follow command to execute the service:

```sh
dapr run --components-path ./components --app-id tracingdemo --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.tracing.TracingDemoService -p 3000
dapr run --app-id tracingdemo --app-port 3000 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.tracing.TracingDemoService -p 3000
```

Once running, the TracingDemoService is now ready to be invoked by Dapr.
Expand Down Expand Up @@ -179,7 +179,7 @@ The class knows the app id for the remote application. It uses `invokeService` m

Execute the follow script in order to run the InvokeClient example, passing two messages for the remote method:
```sh
dapr run --components-path ./components -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.tracing.InvokeClient "message one" "message two"
dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.tracing.InvokeClient "message one" "message two"
```
Once running, the output should display the messages sent from invoker in the demo service output as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*
* <p>1. Build and install jars:
* mvn clean install
* 2. Run in server mode:
* dapr run --components-path ./examples/components --app-id tracingdemo --app-port 3000 --port 3005 \
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
* io.dapr.examples.tracing.TracingDemoService -p 3000
* 2. cd [repo root]/examples
* 3. Run in server mode:
* dapr run --app-id tracingdemo --app-port 3000 \
* -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.tracing.TracingDemoService -p 3000
*/
public class TracingDemoService {

Expand Down