kafka

package
v0.0.0-...-1b33b2a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BrokerMessageMaxBytesConfigName specifies the largest record batch size allowed by
	// Kafka brokers.
	// See: https://kafka.apache.org/documentation/#brokerconfigs_message.max.bytes
	BrokerMessageMaxBytesConfigName = "message.max.bytes"
	// TopicMaxMessageBytesConfigName specifies the largest record batch size allowed by
	// Kafka topics.
	// See: https://kafka.apache.org/documentation/#topicconfigs_max.message.bytes
	TopicMaxMessageBytesConfigName = "max.message.bytes"
)
View Source
const (
	// DefaultMockTopicName specifies the default mock topic name.
	DefaultMockTopicName = "mock_topic"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterAdminClient

type ClusterAdminClient interface {
	// ListTopics list the topics available in the cluster with the default options.
	ListTopics() (map[string]sarama.TopicDetail, error)
	// DescribeCluster gets information about the nodes in the cluster
	DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error)
	// DescribeConfig gets the configuration for the specified resources.
	DescribeConfig(resource sarama.ConfigResource) ([]sarama.ConfigEntry, error)
	// CreateTopic creates a new topic.
	CreateTopic(topic string, detail *sarama.TopicDetail, validateOnly bool) error
	// Close shuts down the admin and closes underlying client.
	Close() error
}

ClusterAdminClient is the administrative client for Kafka, which supports managing and inspecting topics, brokers, configurations and ACLs.

func NewMockAdminClient

func NewMockAdminClient(_ []string, _ *sarama.Config) (ClusterAdminClient, error)

NewMockAdminClient constructs a ClusterAdminClient with mock implementation.

func NewSaramaAdminClient

func NewSaramaAdminClient(addrs []string, conf *sarama.Config) (ClusterAdminClient, error)

NewSaramaAdminClient constructs a ClusterAdminClient with sarama.

type ClusterAdminClientCreator

type ClusterAdminClientCreator func([]string, *sarama.Config) (ClusterAdminClient, error)

ClusterAdminClientCreator defines the type of cluster admin client crater.

type ClusterAdminClientMockImpl

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

ClusterAdminClientMockImpl mock implements the admin client interface.

func NewClusterAdminClientMockImpl

func NewClusterAdminClientMockImpl() *ClusterAdminClientMockImpl

NewClusterAdminClientMockImpl news a ClusterAdminClientMockImpl struct with default configurations.

func (*ClusterAdminClientMockImpl) Close

func (c *ClusterAdminClientMockImpl) Close() error

Close do nothing.

func (*ClusterAdminClientMockImpl) CreateTopic

func (c *ClusterAdminClientMockImpl) CreateTopic(topic string, detail *sarama.TopicDetail, _ bool) error

CreateTopic adds topic into map.

func (*ClusterAdminClientMockImpl) DescribeCluster

func (c *ClusterAdminClientMockImpl) DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error)

DescribeCluster returns the controller ID.

func (*ClusterAdminClientMockImpl) DescribeConfig

DescribeConfig return brokerConfigs directly.

func (*ClusterAdminClientMockImpl) GetDefaultMaxMessageBytes

func (c *ClusterAdminClientMockImpl) GetDefaultMaxMessageBytes() int

GetDefaultMaxMessageBytes returns defaultMaxMessageBytes as a number.

func (*ClusterAdminClientMockImpl) GetDefaultMockTopicName

func (c *ClusterAdminClientMockImpl) GetDefaultMockTopicName() string

GetDefaultMockTopicName returns the default topic name

func (*ClusterAdminClientMockImpl) ListTopics

func (c *ClusterAdminClientMockImpl) ListTopics() (map[string]sarama.TopicDetail, error)

ListTopics returns all topics directly.

Jump to

Keyboard shortcuts

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