-
Notifications
You must be signed in to change notification settings - Fork 12
/
base.go
34 lines (27 loc) · 896 Bytes
/
base.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
package actor
import (
"github.com/wwj31/godactor/actor/err"
)
type ActorHanlerBase struct {
IActor
}
func (s *ActorHanlerBase) initActor(actor IActor) {
s.IActor = actor
}
func (s *ActorHanlerBase) Init() {}
func (s *ActorHanlerBase) Stop() bool { return true }
func (s *ActorHanlerBase) HandleMessage(sourceId, targetId string, msg interface{}) {
logger.KV("actorId", s.GetID()).Warn("not implement HandleMessage")
}
func (s *ActorHanlerBase) HandleRequest(sourceId, targetId, requestId string, msg interface{}) (respErr error) {
return err.ActorUnimplemented
}
func (s *ActorHanlerBase) HandleEvent(event interface{}) {
logger.KV("actorId", s.GetID()).Warn("not implement HandleEvent")
}
func (s *ActorHanlerBase) BResponse(requestId string, msg interface{}) {
e := s.IActor.Response(requestId, msg)
if e != nil {
logger.KV("err", e).ErrorStack(3, "Response error")
}
}