Documentation
¶
Index ¶
- Variables
- func DefaultServiceOptions(opt *Options)
- func UniqueName(name string, uniqueID string) string
- type Error
- type Factory
- type Option
- type Options
- type Request
- type Response
- type Service
- func (s *Service) Call(req interfaces.Request, raw interface{})
- func (s *Service) Close()
- func (s *Service) Decode(data []byte, to interface{}) error
- func (s *Service) Emit(topic string, data interface{}) error
- func (s *Service) Handle(path string, handler interface{}, factory Factory)
- func (s *Service) HandleWithoutLogging(path string, handler interface{}, factory Factory)
- func (s *Service) Listen(callback func())
- func (s *Service) On(topic string, handler func([]byte))
- func (s *Service) OnClose(handler func())
- func (s *Service) RegisterHealthCheck(check *health.Dependency)
- func (s *Service) String() string
- func (s *Service) SubscribeForRawMsg(topic string, handler func(interface{}))
Constants ¶
This section is empty.
Variables ¶
View Source
var ServiceError = oerror.New
ServiceError for orion
Functions ¶
func UniqueName ¶
UniqueName for given name and unique id
Types ¶
type Factory ¶
type Factory = func() interfaces.Request
Factory func type - the one that creates the req obj
type Options ¶
type Options struct { Codec interfaces.Codec Transport interfaces.Transport Logger interfaces.Logger DisableHealthChecks bool HTTPPort int }
Options object
type Service ¶
type Service struct { ID string Name string Timeout int Codec interfaces.Codec Transport interfaces.Transport Logger interfaces.Logger ThreadPool *ants.PoolWithFunc HealthChecks []health.Dependency StopHealthCheck chan struct{} HTTPServer *http.Server HTTPPort int DisableHealthChecks bool }
Service for orion
func (*Service) Call ¶
func (s *Service) Call(req interfaces.Request, raw interface{})
Call orion service
func (*Service) Handle ¶
Handle has enabled logging. What that means is when the request arrives the service will log the request including the raw params. Once the response is returned, the service will check for error and if there is such, the error will be logged
func (*Service) HandleWithoutLogging ¶
HandleWithoutLogging enabled
func (*Service) OnClose ¶
func (s *Service) OnClose(handler func())
OnClose adds a handler to a transport connection closed event
func (*Service) RegisterHealthCheck ¶
func (s *Service) RegisterHealthCheck(check *health.Dependency)
func (*Service) SubscribeForRawMsg ¶
SubscribeForRawMsg is like service.On except that it receives the raw messages specific for the transport protocol instead of the message payload
Click to show internal directories.
Click to hide internal directories.