Skip to content

Improve Actor sample #758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 20 additions & 8 deletions examples/Actor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,8 @@ The `ActorClient` project shows how to make client calls for actor using Remotin
Run the client project from `ActorClient` directory as:

```sh
dotnet run
```

*Note: If you started the actor service with dapr port other than 3500, then set the environment variable DAPR_HTTP_PORT to the value of --dapr-http-port specified while starting the actor service before running the client in terminal.*
```
On Windows: set DAPR_HTTP_PORT=<port>
On Linux, MacOS: export DAPR_HTTP_PORT=<port>
```
dapr run --app-id actor_client dotnet run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for doing this? You don't need to run this app with a dapr sidecar to invoke the actors. I think showing that you can interact with actors from outside of dapr is an important point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then both options should be added to the docs to explain the two ways.

In real scenarios, even if you are communicating with actors from the outside - this "outside" application will not run in the actors cluster - thus expecting dapr sidecar of the actors app is running on the same machine will not be possible.

```

### Invoke Actor method without Remoting over Http

Expand All @@ -65,6 +59,16 @@ curl -X POST http://127.0.0.1:3500/v1.0/actors/DemoActor/abc/method/SaveData -d

```

Or, using the Visual Studio Code [Rest Client Plugin](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)

[sample.http](sample.http)

```http
POST http://localhost:3500/v1.0/actors/DemoActor/abc/method/SaveData

{ "PropertyA": "ValueA", "PropertyB": "ValueB" }
```

**Get Data**
Following curl call will get data for actor id "abc"
(below calls on MacOs, Linux & Windows are exactly the same except for escaping quotes on Windows for curl)
Expand All @@ -80,3 +84,11 @@ On Windows:
```sh
curl -X POST http://127.0.0.1:3500/v1.0/actors/DemoActor/abc/method/GetData
```

Or, using the Visual Studio Code [Rest Client Plugin](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)

[sample.http](sample.http)

```http
GET http://localhost:3500/v1.0/actors/DemoActor/abc/method/GetData
```
7 changes: 7 additions & 0 deletions examples/Actor/sample.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
POST http://localhost:3500/v1.0/actors/DemoActor/abc/method/SaveData

{ "PropertyA": "ValueA", "PropertyB": "ValueB" }

###

GET http://localhost:3500/v1.0/actors/DemoActor/abc/method/GetData