@@ -74,7 +74,7 @@ async function start() {
74
74
75
75
``` javascript
76
76
import { DaprServer , DaprClient } from " dapr-client" ;
77
- import DemoActor from " ./actor/DemoActor " ;
77
+ import StateActor from " ./actor/StateActor " ;
78
78
79
79
const daprHost = " 127.0.0.1" ;
80
80
const daprPort = " 50000" ; // Dapr Sidecar Port of this Example Server
@@ -88,35 +88,35 @@ async function start() {
88
88
89
89
// Creating actor bindings
90
90
await server .actor .init ();
91
- server .actor .registerActor (DemoActor );
91
+ server .actor .registerActor (StateActor );
92
92
await server .startServer ();
93
93
94
94
const actorId = " actor-id" ;
95
95
96
- await client .actor .stateTransaction (" DemoActor " , actorId, [
96
+ await client .actor .stateTransaction (" StateActor " , actorId, [
97
97
{
98
98
operation: " upsert" ,
99
99
request: {
100
- key: " key-1 " ,
101
- value: " my-new-data-1 "
100
+ key: " first-key " ,
101
+ value: " hello "
102
102
}
103
103
},
104
104
{
105
105
operation: " upsert" ,
106
106
request: {
107
- key: " key-to-delete " ,
108
- value: " my-new-data-1 "
107
+ key: " second-key " ,
108
+ value: " world "
109
109
}
110
110
},
111
111
{
112
112
operation: " delete" ,
113
113
request: {
114
- key: " key-to-delete "
114
+ key: " second-key "
115
115
}
116
116
}
117
117
]);
118
118
119
- const ActorStateGet = await client .actor .stateGet (" DemoActor " , actorId, " key-to-delete " );
119
+ const ActorStateGet = await client .actor .stateGet (" StateActor " , actorId, " first-key " );
120
120
}
121
121
```
122
122
@@ -160,7 +160,7 @@ async function start() {
160
160
period: Temporal .Duration .from ({ seconds: 1 })
161
161
});
162
162
163
- // Stop the timer
163
+ // Delete the timer
164
164
await client .actor .timerDelete (ActorTimerImpl .name , actorId, timerId);
165
165
}
166
166
```
@@ -186,7 +186,7 @@ async function start() {
186
186
await server .startServer ();
187
187
188
188
const actorId = " actor-id" ;
189
- const timerId = " actor-timer-id" ;
189
+ const reminderId = " actor-timer-id" ;
190
190
191
191
// Activate our actor
192
192
await client .actor .invoke (" PUT" , ActorReminderImpl .name , actorId, " init" );
@@ -198,7 +198,7 @@ async function start() {
198
198
data: 100
199
199
});
200
200
201
- const res0 = await client . actor . invoke ( " PUT " , ActorReminderImpl . name , actorId, " getCounter " );
201
+ // Delete the reminder
202
202
await client .actor .reminderDelete (ActorReminderImpl .name , actorId, reminderId);
203
203
` ` `
204
204
0 commit comments