-
Notifications
You must be signed in to change notification settings - Fork 0
/
actorsystem_test.go
36 lines (29 loc) · 799 Bytes
/
actorsystem_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package actorsystem
import (
"fmt"
"reflect"
"testing"
"time"
"github.com/yuwnloyblog/gmicro/utils"
"google.golang.org/protobuf/proto"
)
func TestNewActorSystemNoRpc(t *testing.T) {
// actorSystem := NewActorSystemNoRpc("MyActorSystem")
// actorSystem.RegisterActorProcessor("m1", func() proto.Message {
// return &utils.Student{}
// }, ActorSystemDemoProcessor, 10)
// stu := &utils.Student{
// Name: "name2",
// Age: 1,
// }
// actor := actorSystem.LocalActorOf("m1")
// actor.Tell(stu, NoSender)
time.Sleep(5 * time.Second)
}
func ActorSystemDemoProcessor(sender ActorRef, input proto.Message) {
fmt.Println("process has been executed.")
fmt.Println("type:", reflect.TypeOf(input))
stu := input.(*utils.Student)
fmt.Println(stu.Name)
sender.Tell(stu, NoSender)
}