mirror of https://github.com/dapr/java-sdk.git
Replace deprecated cli options with new ones (#318)
* Replace deprecated cli options with new ones
* Change DAPR_CLI_REF in build.yaml
* Change DAPR_REF in build.yaml
* Revert "Change DAPR_CLI_REF in build.yaml"
This reverts commit 7d9621f3aa
.
This commit is contained in:
parent
56927daedd
commit
bc4c5e1cee
|
@ -199,12 +199,12 @@ If you have a Java application or an issue on this SDK that needs to be debugged
|
|||
For Linux and MacOS:
|
||||
|
||||
```sh
|
||||
dapr run --app-id testapp --app-port 3000 --port 3500 --grpc-port 5001 -- cat
|
||||
dapr run --app-id testapp --app-port 3000 --dapr-http-port 3500 --dapr-grpc-port 5001 -- cat
|
||||
```
|
||||
|
||||
For Windows:
|
||||
```sh
|
||||
dapr run --app-id testapp --app-port 3000 --port 3500 --grpc-port 5001 -- waitfor FOREVER
|
||||
dapr run --app-id testapp --app-port 3000 --dapr-http-port 3500 --dapr-grpc-port 5001 -- waitfor FOREVER
|
||||
```
|
||||
|
||||
When running your Java application from IDE, make sure the following environment variables are set, so the Java SDK knows how to connect to Dapr's sidecar:
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the client:
|
||||
* dapr run --components-path ./components --app-id demoactorclient --port 3006 -- java -jar \
|
||||
* dapr run --components-path ./components --app-id demoactorclient --dapr-http-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 --components-path ./components --app-id demoactorservice --app-port 3000 --port 3005 \
|
||||
* dapr run --components-path ./components --app-id demoactorservice --app-port 3000 --dapr-http-port 3005 \
|
||||
* -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \
|
||||
* io.dapr.examples.actors.http.DemoActorService -p 3000
|
||||
*/
|
||||
|
|
|
@ -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 --port 3005 -- java -jar 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 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorService -p 3000
|
||||
```
|
||||
|
||||
### Running the Actor client
|
||||
|
@ -187,7 +187,7 @@ First, the client defines how many actors it is going to create. Then the main m
|
|||
Use the follow command to execute the DemoActorClient:
|
||||
|
||||
```sh
|
||||
dapr run --components-path ./components --app-id demoactorclient --port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient
|
||||
dapr run --components-path ./components --app-id demoactorclient --dapr-http-port 3006 -- java -jar 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 --components-path ./components --app-id inputbinding --app-port 3000 --port 3005 \
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.io.IOException;
|
|||
* mvn clean install
|
||||
* 2. cd to [repo-root]/examples
|
||||
* 3. Run the program:
|
||||
* dapr run --components-path ./components --app-id outputbinding --port 3006 \
|
||||
* 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
|
||||
*/
|
||||
public class OutputBindingExample {
|
||||
|
|
|
@ -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 --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 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.InputBindingExample -p 3000
|
||||
```
|
||||
|
||||
### Running the Output binding sample
|
||||
|
@ -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 --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 --dapr-http-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:
|
||||
|
|
|
@ -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 --components-path ./components --app-id hellogrpc --app-port 5000 --protocol grpc \
|
||||
* 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
|
||||
|
|
|
@ -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 --protocol grpc -- java -jar 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 --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).
|
||||
|
|
|
@ -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 --components-path ./components --app-id invokedemo --app-port 3000 --port 3005 \
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.io.IOException;
|
|||
* 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 \
|
||||
* --dapr-http-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 {
|
||||
|
|
|
@ -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 --port 3005 -- java -jar 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 --dapr-http-port 3005 -- 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.
|
||||
|
@ -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 --port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two'
|
||||
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'
|
||||
```
|
||||
Once running, the output should display the messages sent from invoker in the demo service output as follows:
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Collections;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the program:
|
||||
* dapr run --components-path ./components --app-id publisher --port 3006 -- \
|
||||
* 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
|
||||
*/
|
||||
public class Publisher {
|
||||
|
|
|
@ -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 --port 3005 -- java -jar 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 --dapr-http-port 3005 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000
|
||||
```
|
||||
|
||||
### Running the publisher
|
||||
|
@ -128,7 +128,7 @@ public class Publisher {
|
|||
Use the follow command to execute the Publisher example:
|
||||
|
||||
```sh
|
||||
dapr run --components-path ./components --app-id publisher --port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher
|
||||
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
|
||||
```
|
||||
|
||||
Once running, the Publisher should print the output as follows:
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.commons.cli.Options;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. Run the server:
|
||||
* dapr run --components-path ./components --app-id subscriber --app-port 3000 --port 3005 -- \
|
||||
* 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
|
||||
*/
|
||||
public class Subscriber {
|
||||
|
@ -39,4 +39,4 @@ public class Subscriber {
|
|||
// Start Dapr's callback endpoint.
|
||||
DaprApplication.start(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ The code uses the `DaprClient` created by the `DaprClientBuilder`. Notice that t
|
|||
|
||||
Run this example with the following command:
|
||||
```sh
|
||||
dapr run --components-path ./components --port 3006 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.state.StateClient 'my message'
|
||||
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'
|
||||
```
|
||||
Once running, the OutputBindingExample should print the output as follows:
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.io.IOException;
|
|||
* 1. Build and install jars:
|
||||
* mvn clean install
|
||||
* 2. send a message to be saved as state:
|
||||
* dapr run --components-path ./components --port 3006 -- \
|
||||
* 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'
|
||||
*/
|
||||
|
|
|
@ -160,8 +160,8 @@ public class DaprRun {
|
|||
private static String buildDaprCommand(String appName, Class serviceClass, DaprPorts ports) {
|
||||
StringBuilder stringBuilder = new StringBuilder(String.format(DAPR_RUN, appName))
|
||||
.append(ports.getAppPort() != null ? " --app-port " + ports.getAppPort() : "")
|
||||
.append(ports.getHttpPort() != null ? " --port " + ports.getHttpPort() : "")
|
||||
.append(ports.getGrpcPort() != null ? " --grpc-port " + ports.getGrpcPort() : "")
|
||||
.append(ports.getHttpPort() != null ? " --dapr-http-port " + ports.getHttpPort() : "")
|
||||
.append(ports.getGrpcPort() != null ? " --dapr-grpc-port " + ports.getGrpcPort() : "")
|
||||
.append(String.format(DAPR_COMMAND, serviceClass.getCanonicalName(),
|
||||
ports.getAppPort() != null ? ports.getAppPort().toString() : ""));
|
||||
return stringBuilder.toString();
|
||||
|
|
|
@ -10,7 +10,7 @@ package io.dapr.it.services;
|
|||
* <p>
|
||||
* To run manually, from repo root:
|
||||
* 1. mvn clean install
|
||||
* 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
|
||||
* 2. dapr run --components-path ./components --dapr-grpc-port 41707 --dapr-http-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 --components-path ./components --grpc-port 50001 -- mvn exec:java -Dexec.mainClass=io.dapr.it.state.HelloWorldGrpcStateService -Dexec.classpathScope="test" -pl=sdk
|
||||
* 2. dapr run --components-path ./components --dapr-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