kafkaadmin

package
v3.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

GoDoc

Documentation

Overview

Package kafkaadmin provides Kafka administrative functionality.

Index

Constants

This section is empty.

Variables

View Source
var (

	// SecurityProtocolSet is the set of protocols supported to communicate with brokers
	SecurityProtocolSet = map[string]struct{}{"PLAINTEXT": empty, "SSL": empty, "SASL_PLAINTEXT": empty, "SASL_SSL": empty}
	// SASLMechanismSet is the set of mechanisms supported for client to broker authentication
	SASLMechanismSet = map[string]struct{}{"PLAIN": empty, "SCRAM-SHA-256": empty, "SCRAM-SHA-512": empty}
)

Functions

func NewConsumer added in v3.5.0

func NewConsumer(cfg Config) (*kafka.Consumer, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements a KafkaAdmin.

func NewClientWithFactory

func NewClientWithFactory(cfg Config, factory FactoryFunc) (*Client, error)

NewClientWithFactory returns a new admin Client using a factory func for the kafkaAdminClient

func (Client) Close

func (c Client) Close()

Close closes the Client.

func (Client) CreateTopic

func (c Client) CreateTopic(ctx context.Context, cfg CreateTopicConfig) error

CreateTopic creates a topic.

func (Client) DeleteTopic added in v3.6.0

func (c Client) DeleteTopic(ctx context.Context, name string) error

DeleteTopic deletes a topic.

type Config

type Config struct {
	BootstrapServers string
	GroupId          string
	SSLCALocation    string
	SecurityProtocol string
	SASLMechanism    string
	SASLUsername     string
	SASLPassword     string
}

Config holds Client configuration parameters.

type CreateTopicConfig added in v3.7.0

type CreateTopicConfig struct {
	Name              string
	Partitions        int
	ReplicationFactor int
	Config            map[string]string
	ReplicaAssignment ReplicaAssignment
}

CreateTopicConfig holds CreateTopic parameters.

type FactoryFunc

type FactoryFunc func(conf *kafka.ConfigMap) (*kafka.AdminClient, error)

type KafkaAdmin added in v3.7.0

type KafkaAdmin interface {
	Close()
	CreateTopic(context.Context, CreateTopicConfig) error
	DeleteTopic(context.Context, string) error
}

KafkaAdmin interface.

func NewClient

func NewClient(cfg Config) (KafkaAdmin, error)

NewClient returns a KafkaAdmin.

type ReplicaAssignment added in v3.7.0

type ReplicaAssignment [][]int32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL