Documentation ¶
Index ¶
- Constants
- type CallOptions
- type EventHandler
- type RequestHandler
- type Service
- type ServiceBroker
- func (broker *ServiceBroker) Broadcast(event string, params interface{}) (err error)
- func (broker *ServiceBroker) Call(action string, params interface{}, opts *CallOptions) (data interface{}, err error)
- func (broker *ServiceBroker) Emit(event string, params interface{}) (err error)
- func (broker *ServiceBroker) Start() (err error)
- func (broker *ServiceBroker) Stop() (err error)
- type ServiceBrokerConfig
Constants ¶
View Source
const ( //MoleculerLibVersion = "0.5.0" MoleculerLibVersion = "0.5.0" //MoleculerProtocolVersion = "3" ~ 0.12 MoleculerJs MoleculerProtocolVersion = "3" )
View Source
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel uint32 = iota // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOptions ¶
type CallOptions struct { Timeout time.Duration RetryCount uint64 //not support now NodeID string Meta interface{} }
CallOptions ...
type RequestHandler ¶
RequestHandler NOTE that you should not modify req, just return data or error
type Service ¶
type Service struct { ServiceName string Actions map[string]RequestHandler Events map[string]EventHandler }
Service ...
type ServiceBroker ¶
type ServiceBroker struct {
// contains filtered or unexported fields
}
ServiceBroker ...
func NewServiceBroker ¶
func NewServiceBroker(config *ServiceBrokerConfig) (*ServiceBroker, error)
NewServiceBroker ...
func (*ServiceBroker) Broadcast ¶
func (broker *ServiceBroker) Broadcast(event string, params interface{}) (err error)
Broadcast ...
func (*ServiceBroker) Call ¶
func (broker *ServiceBroker) Call(action string, params interface{}, opts *CallOptions) (data interface{}, err error)
Call you can set opts=nil, or custom opts.Timeout (default:5s)
func (*ServiceBroker) Emit ¶
func (broker *ServiceBroker) Emit(event string, params interface{}) (err error)
Emit ...
Click to show internal directories.
Click to hide internal directories.