mirror of https://github.com/dapr/java-sdk.git
Adding --components-path in all examples. (#304)
This commit is contained in:
parent
5eba96437f
commit
25e6e158dc
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the client:
|
||||
* dapr run --app-id demoactorclient --port 3006 -- java -jar \
|
||||
* dapr run --components-path ./components --app-id demoactorclient --port 3006 -- java -jar \
|
||||
* examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient
|
||||
*/
|
||||
public class DemoActorClient {
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.time.Duration;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the server:
|
||||
* dapr run --app-id demoactorservice --app-port 3000 --port 3005 \
|
||||
* dapr run --components-path ./components --app-id demoactorservice --app-port 3000 --port 3005 \
|
||||
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.actors.http.DemoActorService -p 3000
|
||||
*/
|
||||
|
|
|
@ -124,7 +124,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
|
||||
cd to [repo-root]
|
||||
dapr run --app-id demoactorservice --app-port 3000 --port 3005 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorService -p 3000
|
||||
dapr run --components-path ./components --app-id demoactorservice --app-port 3000 --port 3005 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorService -p 3000
|
||||
```
|
||||
|
||||
### Running the Actor client
|
||||
|
@ -184,7 +184,7 @@ Use the follow command to execute the DemoActorClient:
|
|||
|
||||
```sh
|
||||
cd to [repo-root]
|
||||
dapr run --app-id demoactorclient --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient
|
||||
dapr run --components-path ./components --app-id demoactorclient --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient
|
||||
```
|
||||
|
||||
Once running, the `DemoActorClient` logs will start displaying the different steps:
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.apache.commons.cli.Options;
|
|||
* mvn clean install
|
||||
* 2. cd to [repo-root]/examples
|
||||
* 3. Run :
|
||||
* dapr run --app-id inputbinding --app-port 3000 --port 3005 \
|
||||
* dapr run --components-path ./components --app-id inputbinding --app-port 3000 --port 3005 \
|
||||
* -- java -jar target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.bindings.http.InputBindingExample -p 3000
|
||||
*/
|
||||
|
@ -41,4 +41,4 @@ public class InputBindingExample {
|
|||
// Start Dapr's callback endpoint.
|
||||
DaprApplication.start(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import io.dapr.client.DaprClientBuilder;
|
|||
* mvn clean install
|
||||
* 2. cd to [repo-root]/examples
|
||||
* 3. Run the program:
|
||||
* dapr run --app-id outputbinding --port 3006 \
|
||||
* dapr run --components-path ./components --app-id outputbinding --port 3006 \
|
||||
* -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample
|
||||
*/
|
||||
public class OutputBindingExample {
|
||||
|
@ -67,4 +67,4 @@ public class OutputBindingExample {
|
|||
|
||||
System.out.println("Done.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class InputBindingController {
|
|||
Execute the follow script in order to run the Input Binding example:
|
||||
```sh
|
||||
cd to [repo-root]/examples
|
||||
dapr run --app-id inputbinding --app-port 3000 --port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3000
|
||||
dapr run --components-path ./components --app-id inputbinding --app-port 3000 --port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3000
|
||||
```
|
||||
|
||||
### Running the Output binding sample
|
||||
|
@ -126,7 +126,7 @@ Use the follow command to execute the Output Binding example:
|
|||
|
||||
```sh
|
||||
cd to [repo-root]/examples
|
||||
dapr run --app-id outputbinding --port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample
|
||||
dapr run --components-path ./components --app-id outputbinding --port 3006 -- 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:
|
||||
|
@ -141,4 +141,4 @@ Once running, the InputBindingExample should print the output as follows:
|
|||
|
||||
Events have been retrieved from the binding.
|
||||
|
||||
For more details on Dapr Spring Boot integration, please refer to [Dapr Spring Boot](../../../springboot/DaprApplication.java) Application implementation.
|
||||
For more details on Dapr Spring Boot integration, please refer to [Dapr Spring Boot](../../../springboot/DaprApplication.java) Application implementation.
|
||||
|
|
|
@ -13,7 +13,7 @@ import io.dapr.client.domain.Verb;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Send messages to the server:
|
||||
* dapr run -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* dapr run --components-path ./components -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.invoke.grpc.HelloWorldClient
|
||||
*/
|
||||
public class HelloWorldClient {
|
||||
|
|
|
@ -30,7 +30,7 @@ import static io.dapr.examples.DaprExamplesProtos.SayResponse;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run in server mode:
|
||||
* dapr run --app-id hellogrpc --app-port 5000 --protocol grpc \
|
||||
* dapr run --components-path ./components --app-id hellogrpc --app-port 5000 --protocol grpc \
|
||||
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.invoke.grpc.HelloWorldService \
|
||||
* -p 5000
|
||||
|
|
|
@ -69,7 +69,7 @@ In the `GrpcHelloWorldDaprService` class, the `onInvoke` method is the most impo
|
|||
Now run the service code:
|
||||
|
||||
```sh
|
||||
dapr run --app-id hellogrpc --app-port 5000 --protocol grpc -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldService -p 5000
|
||||
dapr run --components-path ./components --app-id hellogrpc --app-port 5000 --protocol grpc -- java -jar examples/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).
|
||||
|
@ -108,9 +108,9 @@ 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 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
|
||||
dapr run --components-path ./components -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.grpc.HelloWorldClient
|
||||
```
|
||||
|
||||
Once the messages are sent, use `CTRL+C` to exit Dapr.
|
||||
|
||||
Thanks for playing.
|
||||
Thanks for playing.
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.apache.commons.cli.Options;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run in server mode:
|
||||
* dapr run --app-id invokedemo --app-port 3000 --port 3005 \
|
||||
* dapr run --components-path ./components --app-id invokedemo --app-port 3000 --port 3005 \
|
||||
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.invoke.http.DemoService -p 3000
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@ import io.dapr.client.domain.Verb;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Send messages to the server:
|
||||
* dapr run --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* dapr run --components-path ./components --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two'
|
||||
*/
|
||||
public class InvokeClient {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class DemoServiceController {
|
|||
Use the follow command to execute the demo service example:
|
||||
|
||||
```sh
|
||||
dapr run --app-id invokedemo --app-port 3000 --port 3005 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.DemoService -p 3000
|
||||
dapr run --components-path ./components --app-id invokedemo --app-port 3000 --port 3005 -- java -jar examples/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.
|
||||
|
@ -120,7 +120,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 --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two'
|
||||
dapr run --components-path ./components --port 3006 -- java -jar examples/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:
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Collections;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the program:
|
||||
* dapr run --app-id publisher --port 3006 -- \
|
||||
* dapr run --components-path ./components --app-id publisher --port 3006 -- \
|
||||
* java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
|
||||
*/
|
||||
public class Publisher {
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SubscriberController {
|
|||
```
|
||||
Execute the follow script in order to run the Subscriber example:
|
||||
```sh
|
||||
dapr run --app-id subscriber --app-port 3000 --port 3005 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
|
||||
dapr run --components-path ./components --app-id subscriber --app-port 3000 --port 3005 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
|
||||
```
|
||||
|
||||
### Running the publisher
|
||||
|
@ -118,7 +118,7 @@ public class Publisher {
|
|||
Use the follow command to execute the Publisher example:
|
||||
|
||||
```sh
|
||||
dapr run --app-id publisher --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
|
||||
dapr run --components-path ./components --app-id publisher --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
|
||||
```
|
||||
|
||||
Once running, the Publisher should print the output as follows:
|
||||
|
@ -133,4 +133,4 @@ Once running, the Subscriber should print the output as follows:
|
|||
|
||||
Messages have been retrieved from the topic.
|
||||
|
||||
For more details on Dapr Spring Boot integration, please refer to [Dapr Spring Boot](../../../springboot/DaprApplication.java) Application implementation.
|
||||
For more details on Dapr Spring Boot integration, please refer to [Dapr Spring Boot](../../../springboot/DaprApplication.java) Application implementation.
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.commons.cli.Options;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the server:
|
||||
* dapr run --app-id subscriber --app-port 3000 --port 3005 -- \
|
||||
* dapr run --components-path ./components --app-id subscriber --app-port 3000 --port 3005 -- \
|
||||
* java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
|
||||
*/
|
||||
public class Subscriber {
|
||||
|
@ -39,4 +39,4 @@ public class Subscriber {
|
|||
// Start Dapr's callback endpoint.
|
||||
DaprApplication.start(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ The secret store's name **must** match the component's name defined in `< repo d
|
|||
Execute the follow script in order to run the example:
|
||||
```sh
|
||||
cd to [repo-root]/examples
|
||||
dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
|
||||
dapr run --components-path ./components -- 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:
|
||||
|
@ -109,4 +109,4 @@ Once running, the program should print the output as follows:
|
|||
== APP == {"title":"[my favorite movie]"}
|
||||
```
|
||||
|
||||
Thanks for playing.
|
||||
Thanks for playing.
|
||||
|
|
|
@ -18,7 +18,8 @@ import java.util.Map;
|
|||
* 3. Add secret to vault:
|
||||
* vault kv put secret/dapr/movie title="[my favorite movie]"
|
||||
* 4. Read secret from example:
|
||||
* dapr run -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
|
||||
* dapr run --components-path ./components -- \
|
||||
* java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.secrets.SecretClient movie
|
||||
*/
|
||||
public class SecretClient {
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ The code uses the `DaprClient` created by the `DaprClientBuilder`. Notice that t
|
|||
|
||||
Run this example with the following command:
|
||||
```sh
|
||||
dapr run --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
|
||||
dapr run --components-path ./components --port 3006 -- java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
|
||||
```
|
||||
Once running, the OutputBindingExample should print the output as follows:
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import reactor.core.publisher.Mono;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. send a message to be saved as state:
|
||||
* dapr run --port 3006 -- \
|
||||
* dapr run --components-path ./components --port 3006 -- \
|
||||
* java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.state.StateClient 'my message'
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,7 @@ package io.dapr.it.services;
|
|||
* <p>
|
||||
* To run manually, from repo root:
|
||||
* 1. mvn clean install
|
||||
* 2. dapr run --grpc-port 41707 --port 32851 -- mvn exec:java -Dexec.mainClass=io.dapr.it.services.EmptyService -Dexec.classpathScope="test" -Dexec.args="-p 44511 -grpcPort 41707 -httpPort 32851" -pl=sdk
|
||||
* 2. dapr run --components-path ./components --grpc-port 41707 --port 32851 -- mvn exec:java -Dexec.mainClass=io.dapr.it.services.EmptyService -Dexec.classpathScope="test" -Dexec.args="-p 44511 -grpcPort 41707 -httpPort 32851" -pl=sdk
|
||||
*/
|
||||
public class EmptyService {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import io.grpc.ManagedChannelBuilder;
|
|||
* Simple example.
|
||||
* To run manually, from repo root:
|
||||
* 1. mvn clean install
|
||||
* 2. dapr run --grpc-port 50001 -- mvn exec:java -Dexec.mainClass=io.dapr.it.state.HelloWorldGrpcStateService -Dexec.classpathScope="test" -pl=sdk
|
||||
* 2. dapr run --components-path ./components --grpc-port 50001 -- mvn exec:java -Dexec.mainClass=io.dapr.it.state.HelloWorldGrpcStateService -Dexec.classpathScope="test" -pl=sdk
|
||||
*/
|
||||
public class HelloWorldGrpcStateService {
|
||||
|
||||
|
|
Loading…
Reference in New Issue