Documentation ¶
Index ¶
- type BatchConsumer
- type BatchConsumerConf
- type BatchConsumerOption
- type ConsumeHandle
- type ConsumeHandler
- type ConsumeInterceptor
- type Consumer
- func (c *Consumer) Cleanup(session sarama.ConsumerGroupSession) error
- func (c *Consumer) Close() error
- func (c *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error
- func (c *Consumer) FetchMessage(ctx context.Context) (message *sarama.ConsumerMessage, err error)
- func (c *Consumer) Setup(sarama.ConsumerGroupSession) error
- type ConsumerConfig
- type IConsumer
- type Producer
- type ProducerConfig
- type ProducerHandler
- type ProducerInterceptor
- type ProducerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchConsumer ¶
type BatchConsumer struct {
// contains filtered or unexported fields
}
func NewBatchConsumer ¶
func NewBatchConsumer(cfg BatchConsumerConf, consumer IConsumer, opt ...BatchConsumerOption) *BatchConsumer
func (*BatchConsumer) GracefulStop ¶
func (bc *BatchConsumer) GracefulStop(ctx context.Context)
func (*BatchConsumer) Start ¶
func (bc *BatchConsumer) Start()
func (*BatchConsumer) Stop ¶
func (bc *BatchConsumer) Stop()
type BatchConsumerConf ¶
type BatchConsumerOption ¶
type BatchConsumerOption interface {
// contains filtered or unexported methods
}
A BatchConsumerOption sets options such as interceptor etc.
func WithBatchConsumerInterceptors ¶ added in v1.1.0
func WithBatchConsumerInterceptors(interceptors ...ConsumeInterceptor) BatchConsumerOption
WithBatchConsumerInterceptors returns a ServerOption that sets the Interceptor for the producer.
func WithHandle ¶
func WithHandle(handle ConsumeHandle) BatchConsumerOption
func WithLogger ¶
func WithLogger(logger log15.Logger) BatchConsumerOption
type ConsumeHandler ¶
type ConsumeHandler func(ctx context.Context, msg *sarama.ConsumerMessage) error
type ConsumeInterceptor ¶ added in v1.1.0
type ConsumeInterceptor func(ctx context.Context, msg *sarama.ConsumerMessage, handler ConsumeHandler) error
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func NewConsumer ¶
func NewConsumer(cfg ConsumerConfig, logger log15.Logger) *Consumer
func (*Consumer) Cleanup ¶
func (c *Consumer) Cleanup(session sarama.ConsumerGroupSession) error
Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited but before the offsets are committed for the very last time.
func (*Consumer) ConsumeClaim ¶
func (c *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error
ConsumeClaim must start a consumer loop of ConsumerGroupClaim's Messages(). Once the Messages() channel is closed, the Handler must finish its processing loop and exit.
func (*Consumer) FetchMessage ¶
FetchMessage read and return message
type ConsumerConfig ¶
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ¶
func NewProducer(cfg ProducerConfig, opt ...ProducerOption) *Producer
type ProducerConfig ¶
type ProducerHandler ¶ added in v1.1.0
type ProducerInterceptor ¶ added in v1.1.0
type ProducerInterceptor func(ctx context.Context, msg *sarama.ProducerMessage, handler ProducerHandler) (int32, int64, error)
type ProducerOption ¶ added in v1.1.0
type ProducerOption interface {
// contains filtered or unexported methods
}
A ProducerOption sets options such as interceptor etc.
func WithProducerInterceptors ¶ added in v1.1.0
func WithProducerInterceptors(interceptors ...ProducerInterceptor) ProducerOption
WithProducerInterceptors returns a ServerOption that sets the Interceptor for the producer.