Documentation ¶
Index ¶
- Constants
- func NewService(ctx gousu.IContext) gousu.IService
- type IService
- type MockService
- type Service
- func (s *Service) Done(msg *kafka.Message, err error)
- func (s *Service) Health() error
- func (s *Service) Name() string
- func (s *Service) Produce(topic string, value []byte) error
- func (s *Service) Start() error
- func (s *Service) Stop() error
- func (s *Service) Subscribe(topic string) (chan *kafka.Message, error)
Constants ¶
View Source
const ServiceName = "kafka"
ServiceName is the name of the kafka service
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IService ¶
type IService interface { gousu.IService Subscribe(topic string) (chan *kafka.Message, error) Produce(topic string, value []byte) error Done(msg *kafka.Message, err error) }
IService defines the interface of the kafka service
type MockService ¶
type MockService struct { gousu.MockService DoneFunc func(msg *kafka.Message, err error) SubscribeFunc func(topic string) (chan *kafka.Message, error) ProduceFunc func(topic string, value []byte) error DoneFuncCalled int SubscribeFuncCalled int ProduceFuncCalled int }
MockService for simply mocking IService
func NewMockService ¶
func NewMockService() *MockService
NewMockService creates a new initialized instance of MockService
func (*MockService) Done ¶
func (s *MockService) Done(msg *kafka.Message, err error)
Done calls DoneFunc and increases DoneFuncCalled
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides a service for basic kafka client functionality
func (*Service) Produce ¶
Produce emits a message to a topic The topic is automatically created (when enabled on the kafka server) if it doesn't exist
Click to show internal directories.
Click to hide internal directories.