Documentation
¶
Index ¶
- func GetMechanism(auth Authentication) (sasl.Mechanism, error)
- func NewDialer(mechanism sasl.Mechanism, clientID string) (*kafka.Dialer, error)
- func NewReader(auth Authentication, brokers []string, topic, consumerGroupID, clientID string) (*kafka.Reader, error)
- func NewReaderConfig(brokers, topics []string, dialer *kafka.Dialer) kafka.ReaderConfig
- func NewWriter(auth Authentication, brokers []string, topic, clientID string) (*kafka.Writer, error)
- func NewWriterConfig(brokers []string, topic string, dialer *kafka.Dialer) kafka.WriterConfig
- type Authentication
- type Consumer
- type Producer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMechanism ¶
func GetMechanism(auth Authentication) (sasl.Mechanism, error)
GetMechanism returns a SASL mechanism based on the provided mechanism type, username, and password.
Parameters: - mechanismType: a string representing the type of SASL mechanism to use. - username: a string representing the username for authentication. - password: a string representing the password for authentication.
Returns: - sasl.Mechanism: a SASL mechanism that can be used for authentication. - error: an error if the mechanism type is not supported or if there is an issue creating the mechanism.
func NewDialer ¶
NewDialer creates a new kafka dialer with the specified mechanism and client ID.
The mechanism parameter specifies the SASL mechanism to use for authentication. The clientID parameter specifies the client ID to use for the dialer. Returns a pointer to a kafka.Dialer and an error.
func NewReaderConfig ¶
func NewReaderConfig(brokers, topics []string, dialer *kafka.Dialer) kafka.ReaderConfig
NewReaderConfig creates a new kafka reader configuration.
Parameters: - brokers: a slice of strings representing the list of kafka brokers. - topics: a slice of strings representing the list of kafka topics. - dialer: a kafka.Dialer used for connection.
Returns: - kafka.ReaderConfig: a kafka reader configuration.
func NewWriterConfig ¶
NewWriterConfig returns a kafka.WriterConfig with the specified brokers, topic, and dialer.
brokers is a list of Kafka brokers to connect to, topic is the Kafka topic to write to, and dialer is the dialer to use for connections. kafka.WriterConfig
Types ¶
type Authentication ¶
type Authentication struct { // Mechanism is the name of the SASL mechanism. // Possible values: "", "PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512" (defaults to ""). Mechanism string `yaml:"mechanism,omitempty" json:"mechanism,omitempty"` // User is the authentication username for SASL/* authentication User string `yaml:"user,omitempty" json:"user,omitempty"` // User is the authentication password for SASL/* authentication Password string `yaml:"password,omitempty" json:"password,omitempty"` }
type Consumer ¶
type Consumer struct { GroupID string `yaml:"group_id,omitempty" json:"group_id,omitempty"` TopicMapping map[string]string `yaml:"topic_mapping,omitempty" json:"topic_mapping,omitempty"` // event type to topic. DeadLetterTopic string `yaml:"dead_letter_topic,omitempty" json:"dead_letter_topic,omitempty"` }