-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconsumer_args.go
51 lines (43 loc) · 1.16 KB
/
consumer_args.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package kafkaclient
import (
"github.com/confluentinc/confluent-kafka-go/kafka"
)
// ConsumeArgs specifies the arguments for Consumer.Consume and Consumer.ConsumeEvent.
type ConsumeArgs struct {
Topics []string
RebalanceCb kafka.RebalanceCb
Polling int
Workers uint64
Handler MessageHandler
EventHandler EventHandler
}
// SetTopics is a setter.
func (c *ConsumeArgs) SetTopics(topics []string) *ConsumeArgs {
c.Topics = topics
return c
}
// SetRebalanceCb is a setter.
func (c *ConsumeArgs) SetRebalanceCb(cb kafka.RebalanceCb) *ConsumeArgs {
c.RebalanceCb = cb
return c
}
// SetPolling is a setter.
func (c *ConsumeArgs) SetPolling(polling int) *ConsumeArgs {
c.Polling = polling
return c
}
// SetWorkers is a setter.
func (c *ConsumeArgs) SetWorkers(workers uint64) *ConsumeArgs {
c.Workers = workers
return c
}
// SetHandler is a setter.
func (c *ConsumeArgs) SetHandler(handler MessageHandler) *ConsumeArgs {
c.Handler = handler
return c
}
// SetEventHandler is a setter.
func (c *ConsumeArgs) SetEventHandler(handler EventHandler) *ConsumeArgs {
c.EventHandler = handler
return c
}