Skip to content

Commit 114a627

Browse files
committed
Clean up the Dapr actors JS SDK docs
1 parent 500a739 commit 114a627

File tree

1 file changed

+9
-9
lines changed
  • daprdocs/content/en/js-sdk-docs/js-actors

1 file changed

+9
-9
lines changed

daprdocs/content/en/js-sdk-docs/js-actors/_index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ The actor interface defines the contract that is shared between the actor implem
2121

2222
```javascript
2323
export default interface ActorSayInterface {
24-
sayString(msg: string): string;
24+
say(msg: string): string;
2525
}
2626
```
2727

2828
## Actor Implementation
29-
An actor service hosts the virtual actor. It defines a class by extending the base type Actor and implements the interfaces defined in the actor interface.
29+
An actor implementation defines a class by extending the base type `AbstractActor` and implements the interfaces defined in the actor interface.
3030

3131
```javascript
3232
import { AbstractActor } from "dapr-client";
33-
import ActorSayMsgInterface from "./ActorSayMsgInterface";
33+
import ActorSayInterface from "./ActorSayInterface";
3434

35-
export default class ActorSayMsgImp extends AbstractActor implements ActorSayMsgInterface {
35+
export default class ActorSayImp extends AbstractActor implements ActorSayInterface {
3636
say(msg: string): string {
3737
return `Actor said: "${msg}"`;
3838
}
3939
}
4040
```
4141

4242
## Invoking Actors
43-
An actor client contains the implementation of the actor client which calls the actor methods defined in the actor interface.
43+
Use the DaprServer package to create your actors bindings, which will initalize and register your actors. After Actors are registered, use the DaprClient to invoke methods on an actor. The will client call the actor methods defined in the actor interface.
4444

4545
```javascript
46-
import { DaprServer, DaprClient, HttpMethod } from "dapr-client";
47-
import ActorSayMsgImp from "./actor/ActorSayMsgImp";
46+
import { DaprServer, DaprClient } from "dapr-client";
47+
import ActorSayImp from "./actor/ActorSayImp";
4848

4949
const daprHost = "127.0.0.1";
5050
const daprPort = "50000"; // Dapr Sidecar Port of this Example Server
@@ -58,15 +58,15 @@ async function start() {
5858

5959
// Creating actor bindings
6060
await server.actor.init();
61-
server.actor.registerActor(ActorSayMsgImp);
61+
server.actor.registerActor(ActorSayImp);
6262

6363
const actorId = "actor-id";
6464
const timerId = "actor-timer-id";
6565

6666
await server.startServer();
6767

6868
// Invoke method 'say' with msg 'Hello World'");
69-
const resActorInvokeSay = await client.actor.invoke("PUT", ActorSayMsgImp.name, actorId, "method-to-invoke", "Hello World");
69+
const resActorInvokeSay = await client.actor.invoke("PUT", ActorSayImp.name, actorId, "method-to-invoke", "Hello World");
7070
}
7171
```
7272

0 commit comments

Comments
 (0)