Documentation ¶
Index ¶
- type AsyncBuilder
- func (ab *AsyncBuilder) Create() (*AsyncProducer, error)
- func (ab *AsyncBuilder) WithEncoder(enc encoding.EncodeFunc, contentType string) *AsyncBuilder
- func (ab *AsyncBuilder) WithRequiredAcksPolicy(ack RequiredAcks) *AsyncBuilder
- func (ab *AsyncBuilder) WithTimeout(dial time.Duration) *AsyncBuilder
- func (ab *AsyncBuilder) WithVersion(version string) *AsyncBuilder
- type AsyncProducer
- type Message
- type Producer
- type RequiredAcks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncBuilder ¶ added in v0.31.0
type AsyncBuilder struct {
// contains filtered or unexported fields
}
AsyncBuilder gathers all required and optional properties, in order to construct a Kafka AsyncProducer.
func NewBuilder ¶ added in v0.31.0
func NewBuilder(brokers []string) *AsyncBuilder
NewBuilder initiates the AsyncProducer builder chain. The builder instantiates the component using default values for EncodeFunc and Content-Type header.
func (*AsyncBuilder) Create ¶ added in v0.31.0
func (ab *AsyncBuilder) Create() (*AsyncProducer, error)
Create constructs the AsyncProducer component by applying the gathered properties.
func (*AsyncBuilder) WithEncoder ¶ added in v0.31.0
func (ab *AsyncBuilder) WithEncoder(enc encoding.EncodeFunc, contentType string) *AsyncBuilder
WithEncoder sets a specific encoder implementation and Content-Type string header; if no option is provided it defaults to json.
func (*AsyncBuilder) WithRequiredAcksPolicy ¶ added in v0.31.0
func (ab *AsyncBuilder) WithRequiredAcksPolicy(ack RequiredAcks) *AsyncBuilder
WithRequiredAcksPolicy adjusts how many replica acknowledgements broker must see before responding.
func (*AsyncBuilder) WithTimeout ¶ added in v0.31.0
func (ab *AsyncBuilder) WithTimeout(dial time.Duration) *AsyncBuilder
WithTimeout sets the dial timeout for the AsyncProducer.
func (*AsyncBuilder) WithVersion ¶ added in v0.31.0
func (ab *AsyncBuilder) WithVersion(version string) *AsyncBuilder
WithVersion sets the kafka versionfor the AsyncProducer.
type AsyncProducer ¶
type AsyncProducer struct {
// contains filtered or unexported fields
}
AsyncProducer defines a async Kafka producer.
func (*AsyncProducer) Error ¶
func (ap *AsyncProducer) Error() <-chan error
Error returns a chanel to monitor for errors.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message abstraction of a Kafka message.
func NewMessage ¶
NewMessage creates a new message.
type Producer ¶
type Producer interface { Send(ctx context.Context, msg *Message) error Error() <-chan error Close() error }
Producer interface for Kafka.
type RequiredAcks ¶ added in v0.26.1
type RequiredAcks int16
RequiredAcks is used in Produce Requests to tell the broker how many replica acknowledgements it must see before responding.
const ( // NoResponse doesn't send any response, the TCP ACK is all you get. NoResponse RequiredAcks = 0 // WaitForLocal waits for only the local commit to succeed before responding. WaitForLocal RequiredAcks = 1 // WaitForAll waits for all in-sync replicas to commit before responding. WaitForAll RequiredAcks = -1 )