package service import ( "fmt" "reflect" cda "git.loafle.net/commons/di-go/annotation" cdr "git.loafle.net/commons/di-go/registry" crc "git.loafle.net/commons/rpc-go/client" // For annotation _ "git.loafle.net/overflow/commons-go/core/annotation" ) var ProbeServiceType = reflect.TypeOf((*ProbeService)(nil)) func init() { cdr.RegisterType(ProbeServiceType) } type ProbeService struct { cda.TypeAnnotation `annotation:"@overflow:RPCService()"` RPCClient *crc.Client `annotation:"@Resource(name='CONTAINER_RPC_CLIENT')"` } func (s *ProbeService) InitService() error { if nil == s.RPCClient { return fmt.Errorf("RPCClient is not valid") } return nil } func (s *ProbeService) StartService() error { return nil } func (s *ProbeService) StopService() { } func (s *ProbeService) DestroyService() { } func (s *ProbeService) Send(method string, params ...interface{}) error { if err := s.RPCClient.Send(method, params...); nil != err { return err } return nil }