mirror of https://github.com/dapr/java-sdk.git
Fix actor sample + remove HTTP reference in docs and code. (#407)
* Fix actor sample + remove HTTP reference in docs and code. * Fix logging for IT.
This commit is contained in:
parent
f871b1f51f
commit
3f51e29dde
|
@ -141,7 +141,7 @@ Try the following examples to learn more about Dapr's Java SDK:
|
||||||
* [State management](./examples/src/main/java/io/dapr/examples/state)
|
* [State management](./examples/src/main/java/io/dapr/examples/state)
|
||||||
* [PubSub with subscriber over Http](./examples/src/main/java/io/dapr/examples/pubsub/http)
|
* [PubSub with subscriber over Http](./examples/src/main/java/io/dapr/examples/pubsub/http)
|
||||||
* [Binding with input over Http](./examples/src/main/java/io/dapr/examples/bindings/http)
|
* [Binding with input over Http](./examples/src/main/java/io/dapr/examples/bindings/http)
|
||||||
* [Actors over Http](./examples/src/main/java/io/dapr/examples/actors/http)
|
* [Actors](./examples/src/main/java/io/dapr/examples/actors/)
|
||||||
* [Secrets management](./examples/src/main/java/io/dapr/examples/secrets)
|
* [Secrets management](./examples/src/main/java/io/dapr/examples/secrets)
|
||||||
* [Distributed tracing with OpenTelemetry SDK](./examples/src/main/java/io/dapr/examples/tracing)
|
* [Distributed tracing with OpenTelemetry SDK](./examples/src/main/java/io/dapr/examples/tracing)
|
||||||
* [Exception handling](./examples/src/main/java/io/dapr/examples/exception)
|
* [Exception handling](./examples/src/main/java/io/dapr/examples/exception)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License.
|
* Licensed under the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.dapr.examples.actors.http;
|
package io.dapr.examples.actors;
|
||||||
|
|
||||||
import io.dapr.actors.ActorMethod;
|
import io.dapr.actors.ActorMethod;
|
||||||
import io.dapr.actors.ActorType;
|
import io.dapr.actors.ActorType;
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License.
|
* Licensed under the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.dapr.examples.actors.http;
|
package io.dapr.examples.actors;
|
||||||
|
|
||||||
import io.dapr.actors.ActorId;
|
import io.dapr.actors.ActorId;
|
||||||
import io.dapr.actors.client.ActorProxyBuilder;
|
import io.dapr.actors.client.ActorProxyBuilder;
|
||||||
|
@ -16,8 +16,8 @@ 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 --dapr-http-port 3006 -- java -jar \
|
* dapr run --components-path ./components --app-id demoactorclient -- java -jar \
|
||||||
* target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.http.DemoActorClient
|
* target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorClient
|
||||||
*/
|
*/
|
||||||
public class DemoActorClient {
|
public class DemoActorClient {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License.
|
* Licensed under the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.dapr.examples.actors.http;
|
package io.dapr.examples.actors;
|
||||||
|
|
||||||
import io.dapr.actors.ActorId;
|
import io.dapr.actors.ActorId;
|
||||||
import io.dapr.actors.runtime.AbstractActor;
|
import io.dapr.actors.runtime.AbstractActor;
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License.
|
* Licensed under the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.dapr.examples.actors.http;
|
package io.dapr.examples.actors;
|
||||||
|
|
||||||
import io.dapr.actors.runtime.ActorRuntime;
|
import io.dapr.actors.runtime.ActorRuntime;
|
||||||
import io.dapr.springboot.DaprApplication;
|
import io.dapr.springboot.DaprApplication;
|
||||||
|
@ -19,9 +19,8 @@ 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 --dapr-http-port 3005 \
|
* dapr run --components-path ./components --app-id demoactorservice --app-port 3000 \
|
||||||
* -- java -jar target/dapr-java-sdk-examples-exec.jar \
|
* -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorService -p 3000
|
||||||
* io.dapr.examples.actors.http.DemoActorService -p 3000
|
|
||||||
*/
|
*/
|
||||||
public class DemoActorService {
|
public class DemoActorService {
|
||||||
|
|
|
@ -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 --dapr-http-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 -- java -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.actors.DemoActorService -p 3000
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running the Actor client
|
### Running the Actor client
|
||||||
|
@ -190,7 +190,7 @@ Then, the code executes the `callActorForever` private method once per actor. In
|
||||||
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 --dapr-http-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 -- 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:
|
Once running, the `DemoActorClient` logs will start displaying the different steps:
|
|
@ -118,7 +118,7 @@ public class ActorReminderRecoveryIT extends BaseIT {
|
||||||
List<MethodEntryTracker> calls =
|
List<MethodEntryTracker> calls =
|
||||||
logs.stream().filter(x -> x.getMethodName().equals(("receiveReminder"))).collect(Collectors.toList());
|
logs.stream().filter(x -> x.getMethodName().equals(("receiveReminder"))).collect(Collectors.toList());
|
||||||
System.out.printf(
|
System.out.printf(
|
||||||
"Size of reminder count list is %d, which means it's been invoked half that many times.", calls.size());
|
"Size of reminder count list is %d, which means it's been invoked half that many times.\n", calls.size());
|
||||||
return calls.size() / 2;
|
return calls.size() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue