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: | For Linux and MacOS: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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: | For Windows: | ||||||
| ```sh | ```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: | 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: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run the client: |  * 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 |  * examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient | ||||||
|  */ |  */ | ||||||
| public class DemoActorClient { | public class DemoActorClient { | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ import java.time.Duration; | ||||||
|  * 1. Build and install jars: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run the server: |  * 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 \ |  *   -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \ | ||||||
|  *   io.dapr.examples.actors.http.DemoActorService -p 3000 |  *   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: | Now, execute the following script in order to run DemoActorService: | ||||||
| ```sh | ```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 | ### 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: | Use the follow command to execute the DemoActorClient: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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:  | Once running, the `DemoActorClient` logs will start displaying the different steps:  | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ import org.apache.commons.cli.Options; | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. cd to [repo-root]/examples |  * 2. cd to [repo-root]/examples | ||||||
|  * 3. Run : |  * 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 \ |  *   -- java -jar target/dapr-java-sdk-examples-exec.jar \ | ||||||
|  *   io.dapr.examples.bindings.http.InputBindingExample -p 3000 |  *   io.dapr.examples.bindings.http.InputBindingExample -p 3000 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import java.io.IOException; | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. cd to [repo-root]/examples |  * 2. cd to [repo-root]/examples | ||||||
|  * 3. Run the program: |  * 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 |  *   -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.bindings.http.OutputBindingExample | ||||||
|  */ |  */ | ||||||
| public class OutputBindingExample { | public class OutputBindingExample { | ||||||
|  |  | ||||||
|  | @ -94,7 +94,7 @@ public class InputBindingController { | ||||||
| 
 | 
 | ||||||
|  Execute the follow script in order to run the Input Binding example: |  Execute the follow script in order to run the Input Binding example: | ||||||
| ```sh | ```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 | ### 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: | Use the follow command to execute the Output Binding example: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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: | 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: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run in server mode: |  * 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 \ |  *   -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \ | ||||||
|  *   io.dapr.examples.invoke.grpc.HelloWorldService \ |  *   io.dapr.examples.invoke.grpc.HelloWorldService \ | ||||||
|  *   -p 5000 |  *   -p 5000 | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ In the `GrpcHelloWorldDaprService` class, the `onInvoke` method is the most impo | ||||||
| Now run the service code: | Now run the service code: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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). | 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: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run in server mode: |  * 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 \ |  *   -- java -jar examples/target/dapr-java-sdk-examples-exec.jar \ | ||||||
|  *   io.dapr.examples.invoke.http.DemoService -p 3000 |  *   io.dapr.examples.invoke.http.DemoService -p 3000 | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import java.io.IOException; | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Send messages to the server: |  * 2. Send messages to the server: | ||||||
|  * dapr run --components-path ./examples/components \ |  * 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' |  * io.dapr.examples.invoke.http.InvokeClient 'message one' 'message two' | ||||||
|  */ |  */ | ||||||
| public class InvokeClient { | public class InvokeClient { | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ public class DemoServiceController { | ||||||
| Use the follow command to execute the demo service example: | Use the follow command to execute the demo service example: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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. | 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: | Execute the follow script in order to run the InvokeClient example, passing two messages for the remote method: | ||||||
| ```sh | ```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: | 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: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run the program: |  * 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 |  *  java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Publisher | ||||||
|  */ |  */ | ||||||
| public class Publisher { | public class Publisher { | ||||||
|  |  | ||||||
|  | @ -77,7 +77,7 @@ public class SubscriberController { | ||||||
| ``` | ``` | ||||||
| Execute the follow script in order to run the Subscriber example: | Execute the follow script in order to run the Subscriber example: | ||||||
| ```sh | ```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 | ### Running the publisher | ||||||
|  | @ -128,7 +128,7 @@ public class Publisher { | ||||||
| Use the follow command to execute the Publisher example: | Use the follow command to execute the Publisher example: | ||||||
| 
 | 
 | ||||||
| ```sh | ```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: | 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: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. Run the server: |  * 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 |  *   java -jar examples/target/dapr-java-sdk-examples-exec.jar io.dapr.examples.pubsub.http.Subscriber -p 3000 | ||||||
|  */ |  */ | ||||||
| public class Subscriber { | public class Subscriber { | ||||||
|  | @ -39,4 +39,4 @@ public class Subscriber { | ||||||
|     // Start Dapr's callback endpoint. |     // Start Dapr's callback endpoint. | ||||||
|     DaprApplication.start(port); |     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: | Run this example with the following command: | ||||||
| ```sh | ```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: | Once running, the OutputBindingExample should print the output as follows: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import java.io.IOException; | ||||||
|  * 1. Build and install jars: |  * 1. Build and install jars: | ||||||
|  * mvn clean install |  * mvn clean install | ||||||
|  * 2. send a message to be saved as state: |  * 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 \ |  * java -jar examples/target/dapr-java-sdk-examples-exec.jar \ | ||||||
|  * io.dapr.examples.state.StateClient 'my message' |  * io.dapr.examples.state.StateClient 'my message' | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -160,8 +160,8 @@ public class DaprRun { | ||||||
|   private static String buildDaprCommand(String appName, Class serviceClass, DaprPorts ports) { |   private static String buildDaprCommand(String appName, Class serviceClass, DaprPorts ports) { | ||||||
|     StringBuilder stringBuilder = new StringBuilder(String.format(DAPR_RUN, appName)) |     StringBuilder stringBuilder = new StringBuilder(String.format(DAPR_RUN, appName)) | ||||||
|         .append(ports.getAppPort() != null ? " --app-port " + ports.getAppPort() : "") |         .append(ports.getAppPort() != null ? " --app-port " + ports.getAppPort() : "") | ||||||
|         .append(ports.getHttpPort() != null ? " --port " + ports.getHttpPort() : "") |         .append(ports.getHttpPort() != null ? " --dapr-http-port " + ports.getHttpPort() : "") | ||||||
|         .append(ports.getGrpcPort() != null ? " --grpc-port " + ports.getGrpcPort() : "") |         .append(ports.getGrpcPort() != null ? " --dapr-grpc-port " + ports.getGrpcPort() : "") | ||||||
|         .append(String.format(DAPR_COMMAND, serviceClass.getCanonicalName(), |         .append(String.format(DAPR_COMMAND, serviceClass.getCanonicalName(), | ||||||
|             ports.getAppPort() != null ? ports.getAppPort().toString() : "")); |             ports.getAppPort() != null ? ports.getAppPort().toString() : "")); | ||||||
|     return stringBuilder.toString(); |     return stringBuilder.toString(); | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ package io.dapr.it.services; | ||||||
|  * <p> |  * <p> | ||||||
|  * To run manually, from repo root: |  * To run manually, from repo root: | ||||||
|  * 1. mvn clean install |  * 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 { | public class EmptyService { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ import io.grpc.ManagedChannelBuilder; | ||||||
|  * Simple example. |  * Simple example. | ||||||
|  * To run manually, from repo root: |  * To run manually, from repo root: | ||||||
|  * 1. mvn clean install |  * 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 { | public class HelloWorldGrpcStateService { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue