Documentation ¶
Index ¶
- Constants
- type Handler
- type HandlerFunc
- type IBroker
- type IConsumer
- type IKafka
- type IKafkaCallback
- type OptionFunc
- type Options
- type Server
- func (srv *Server) AddAfterServerStopFunc(fns ...bootstrap.AfterServerStopFunc)
- func (srv *Server) AddBeforeServerStartFunc(fns ...bootstrap.BeforeServerStartFunc)
- func (srv *Server) ConfigureOptions(options ...OptionFunc)
- func (srv *Server) InjectHandleFuncs(funcs []HandlerFunc)
- func (srv *Server) Server() *IKafka
- func (srv *Server) Start() error
- func (srv *Server) Stop()
Constants ¶
View Source
const ( //StatusOn 启用 StatusOn = "on" //StatusOff 关闭 StatusOff = "off" )
View Source
const MIN_CONSUMER_COUNT = 3
View Source
const RETRY_CONSUMER_NUM = 3
View Source
const RETRY_PRODUCER_NUM = 3
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
type IKafka ¶
type IKafka struct {
// contains filtered or unexported fields
}
func NewIKafka ¶
func NewIKafka(callback IKafkaCallback) (this *IKafka)
type IKafkaCallback ¶
type OptionFunc ¶
type OptionFunc func(*Options)
func ConsumerCnt ¶
func ConsumerCnt(c int) OptionFunc
func FailTopic ¶
func FailTopic(f string) OptionFunc
func GroupName ¶
func GroupName(n string) OptionFunc
func KafkaHost ¶
func KafkaHost(h string) OptionFunc
func Topic ¶
func Topic(t string) OptionFunc
type Options ¶
type Options struct { KafkaHost string `ini:"kafkahost"` Topic string `ini:"topic"` FailTopic string `ini:"failtopic"` ConsumerCnt int `ini:"consumerCnt"` GroupName string `ini:"groupName"` }
Options server options
type Server ¶
type Server struct { Opts Options // contains filtered or unexported fields }
Server struct
func NewServerWithOptions ¶
NewServerWithOptions with options
func (*Server) AddAfterServerStopFunc ¶
func (srv *Server) AddAfterServerStopFunc(fns ...bootstrap.AfterServerStopFunc)
AddAfterServerStopFunc add after function
func (*Server) AddBeforeServerStartFunc ¶
func (srv *Server) AddBeforeServerStartFunc(fns ...bootstrap.BeforeServerStartFunc)
AddBeforeServerStartFunc add before function
func (*Server) ConfigureOptions ¶
func (srv *Server) ConfigureOptions(options ...OptionFunc)
ConfigureOptions 更新配置
func (*Server) InjectHandleFuncs ¶
func (srv *Server) InjectHandleFuncs(funcs []HandlerFunc)
注入消息处理方法
Source Files ¶
Click to show internal directories.
Click to hide internal directories.