Documentation ¶
Index ¶
- type Consumer
- func (c *Consumer) GetAllLastMessages() (map[string]*shared.KafkaMessage, error)
- func (c *Consumer) GetAllTopics() ([]string, error)
- func (c *Consumer) GetLastMessageFromTopic(topic string) (*shared.KafkaMessage, error)
- func (c *Consumer) GetMessage() *shared.KafkaMessage
- func (c *Consumer) GetMessages() <-chan *shared.KafkaMessage
- func (c *Consumer) GetStats() (uint64, uint64)
- func (c *Consumer) GetTopics() []string
- func (c *Consumer) IsReady() bool
- func (c *Consumer) MarkMessage(message *shared.KafkaMessage)
- func (c *Consumer) MarkMessages(messages []*shared.KafkaMessage)
- func (c *Consumer) UnsafeGetClient() *sarama.Client
- type ConsumerGroupHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents a Kafka consumer.
func NewConsumer ¶
func NewConsumer(kafkaBrokers, subscribeRegexes []string, groupId, instanceId string, initialOffset int64) (*Consumer, error)
NewConsumer initializes and returns a new Consumer instance.
func (*Consumer) GetAllLastMessages ¶ added in v1.12.0
func (c *Consumer) GetAllLastMessages() (map[string]*shared.KafkaMessage, error)
func (*Consumer) GetAllTopics ¶ added in v1.12.0
GetAllTopics returns all topics available in the Kafka cluster.
func (*Consumer) GetLastMessageFromTopic ¶ added in v1.12.0
func (c *Consumer) GetLastMessageFromTopic(topic string) (*shared.KafkaMessage, error)
GetLastMessageFromTopic returns the latest message from a topic.
func (*Consumer) GetMessage ¶
func (c *Consumer) GetMessage() *shared.KafkaMessage
GetMessage returns the next message from the consumer.
func (*Consumer) GetMessages ¶
func (c *Consumer) GetMessages() <-chan *shared.KafkaMessage
GetMessages returns the channel of messages from the consumer.
func (*Consumer) IsReady ¶ added in v1.8.10
IsReady returns whether the consumer is ready to consume messages.
func (*Consumer) MarkMessage ¶
func (c *Consumer) MarkMessage(message *shared.KafkaMessage)
MarkMessage marks a message as processed.
func (*Consumer) MarkMessages ¶
func (c *Consumer) MarkMessages(messages []*shared.KafkaMessage)
MarkMessages marks a slice of messages as processed.
func (*Consumer) UnsafeGetClient ¶ added in v1.12.0
UnsafeGetClient should only be used as a last resort.
type ConsumerGroupHandler ¶ added in v1.8.9
type ConsumerGroupHandler struct {
// contains filtered or unexported fields
}
ConsumerGroupHandler represents a Sarama consumer group consumer
func (*ConsumerGroupHandler) Cleanup ¶ added in v1.8.9
func (c *ConsumerGroupHandler) Cleanup(session sarama.ConsumerGroupSession) error
Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited
func (*ConsumerGroupHandler) ConsumeClaim ¶ added in v1.8.9
func (c *ConsumerGroupHandler) 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 (*ConsumerGroupHandler) Setup ¶ added in v1.8.9
func (c *ConsumerGroupHandler) Setup(session sarama.ConsumerGroupSession) error
Setup is run at the beginning of a new session, before ConsumeClaim