kafka

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_client_kafka_conf_proto protoreflect.FileDescriptor

Functions

func MustNewQueue

func MustNewQueue(c *Conf, handler ConsumeHandler) (queue.MessageQueue, error)

func WrapError

func WrapError(err error) error

Types

type Conf

type Conf struct {
	Brokers      []string             `protobuf:"bytes,1,rep,name=brokers,proto3" json:"brokers,omitempty"`
	Net          *Net                 `protobuf:"bytes,2,opt,name=net,proto3" json:"net,omitempty"`
	Group        string               `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"`
	Topic        string               `protobuf:"bytes,4,opt,name=topic,proto3" json:"topic,omitempty"`
	Offset       string               `protobuf:"bytes,5,opt,name=offset,proto3" json:"offset,omitempty"`
	ReadTimeout  *durationpb.Duration `protobuf:"bytes,6,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"`
	WriteTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"`
	Acks         int32                `protobuf:"varint,8,opt,name=acks,proto3" json:"acks,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetAcks

func (x *Conf) GetAcks() int32

func (*Conf) GetBrokers

func (x *Conf) GetBrokers() []string

func (*Conf) GetGroup

func (x *Conf) GetGroup() string

func (*Conf) GetNet

func (x *Conf) GetNet() *Net

func (*Conf) GetOffset

func (x *Conf) GetOffset() string

func (*Conf) GetReadTimeout

func (x *Conf) GetReadTimeout() *durationpb.Duration

func (*Conf) GetTopic

func (x *Conf) GetTopic() string

func (*Conf) GetWriteTimeout

func (x *Conf) GetWriteTimeout() *durationpb.Duration

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Conf) ValidateAll added in v0.0.8

func (m *Conf) ValidateAll() error

ValidateAll checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfMultiError, or nil if none found.

type ConfMultiError added in v0.0.8

type ConfMultiError []error

ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.

func (ConfMultiError) AllErrors added in v0.0.8

func (m ConfMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfMultiError) Error added in v0.0.8

func (m ConfMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfValidationError

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

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type ConsumeHandle added in v0.0.39

type ConsumeHandle func(ctx context.Context, topic string, key, message []byte) error

type ConsumeHandler added in v0.0.39

type ConsumeHandler interface {
	Consume(ctx context.Context, topic string, key, message []byte) error
}

type Consumer

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

func NewConsumer

func NewConsumer(c *Conf, handler ConsumeHandler) (*Consumer, error)

func (*Consumer) Start

func (c *Consumer) Start(context.Context) error

func (*Consumer) Stop

func (c *Consumer) Stop(context.Context) error

type Consumers

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

func NewQueue

func NewQueue(c *Conf, handler ConsumeHandler) (*Consumers, error)

func (Consumers) Name

func (q Consumers) Name() string

func (Consumers) Start

func (q Consumers) Start(ctx context.Context) error

func (Consumers) Stop

func (q Consumers) Stop(ctx context.Context) error

type KafkaMessageTextMapCarrier

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

func (*KafkaMessageTextMapCarrier) Get

func (carrier *KafkaMessageTextMapCarrier) Get(key string) string

Get returns the value associated with the passed key.

func (*KafkaMessageTextMapCarrier) Keys

func (carrier *KafkaMessageTextMapCarrier) Keys() []string

Keys lists the keys stored in this carrier.

func (*KafkaMessageTextMapCarrier) Set

func (carrier *KafkaMessageTextMapCarrier) Set(key string, value string)

Set stores the key-value pair.

type Net

type Net struct {
	Sasl *Net_SASL `protobuf:"bytes,1,opt,name=sasl,proto3" json:"sasl,omitempty"`
	Tls  *Net_TLS  `protobuf:"bytes,2,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

func (*Net) Descriptor deprecated

func (*Net) Descriptor() ([]byte, []int)

Deprecated: Use Net.ProtoReflect.Descriptor instead.

func (*Net) GetSasl

func (x *Net) GetSasl() *Net_SASL

func (*Net) GetTls

func (x *Net) GetTls() *Net_TLS

func (*Net) ProtoMessage

func (*Net) ProtoMessage()

func (*Net) ProtoReflect

func (x *Net) ProtoReflect() protoreflect.Message

func (*Net) Reset

func (x *Net) Reset()

func (*Net) String

func (x *Net) String() string

func (*Net) Validate

func (m *Net) Validate() error

Validate checks the field values on Net with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Net) ValidateAll added in v0.0.8

func (m *Net) ValidateAll() error

ValidateAll checks the field values on Net with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in NetMultiError, or nil if none found.

type NetMultiError added in v0.0.8

type NetMultiError []error

NetMultiError is an error wrapping multiple validation errors returned by Net.ValidateAll() if the designated constraints aren't met.

func (NetMultiError) AllErrors added in v0.0.8

func (m NetMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (NetMultiError) Error added in v0.0.8

func (m NetMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type NetValidationError

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

NetValidationError is the validation error returned by Net.Validate if the designated constraints aren't met.

func (NetValidationError) Cause

func (e NetValidationError) Cause() error

Cause function returns cause value.

func (NetValidationError) Error

func (e NetValidationError) Error() string

Error satisfies the builtin error interface

func (NetValidationError) ErrorName

func (e NetValidationError) ErrorName() string

ErrorName returns error name.

func (NetValidationError) Field

func (e NetValidationError) Field() string

Field function returns field value.

func (NetValidationError) Key

func (e NetValidationError) Key() bool

Key function returns key value.

func (NetValidationError) Reason

func (e NetValidationError) Reason() string

Reason function returns reason value.

type Net_SASL

type Net_SASL struct {
	Enable   bool   `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	User     string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*Net_SASL) Descriptor deprecated

func (*Net_SASL) Descriptor() ([]byte, []int)

Deprecated: Use Net_SASL.ProtoReflect.Descriptor instead.

func (*Net_SASL) GetEnable

func (x *Net_SASL) GetEnable() bool

func (*Net_SASL) GetPassword

func (x *Net_SASL) GetPassword() string

func (*Net_SASL) GetUser

func (x *Net_SASL) GetUser() string

func (*Net_SASL) ProtoMessage

func (*Net_SASL) ProtoMessage()

func (*Net_SASL) ProtoReflect

func (x *Net_SASL) ProtoReflect() protoreflect.Message

func (*Net_SASL) Reset

func (x *Net_SASL) Reset()

func (*Net_SASL) String

func (x *Net_SASL) String() string

func (*Net_SASL) Validate

func (m *Net_SASL) Validate() error

Validate checks the field values on Net_SASL with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Net_SASL) ValidateAll added in v0.0.8

func (m *Net_SASL) ValidateAll() error

ValidateAll checks the field values on Net_SASL with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in Net_SASLMultiError, or nil if none found.

type Net_SASLMultiError added in v0.0.8

type Net_SASLMultiError []error

Net_SASLMultiError is an error wrapping multiple validation errors returned by Net_SASL.ValidateAll() if the designated constraints aren't met.

func (Net_SASLMultiError) AllErrors added in v0.0.8

func (m Net_SASLMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (Net_SASLMultiError) Error added in v0.0.8

func (m Net_SASLMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type Net_SASLValidationError

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

Net_SASLValidationError is the validation error returned by Net_SASL.Validate if the designated constraints aren't met.

func (Net_SASLValidationError) Cause

func (e Net_SASLValidationError) Cause() error

Cause function returns cause value.

func (Net_SASLValidationError) Error

func (e Net_SASLValidationError) Error() string

Error satisfies the builtin error interface

func (Net_SASLValidationError) ErrorName

func (e Net_SASLValidationError) ErrorName() string

ErrorName returns error name.

func (Net_SASLValidationError) Field

func (e Net_SASLValidationError) Field() string

Field function returns field value.

func (Net_SASLValidationError) Key

func (e Net_SASLValidationError) Key() bool

Key function returns key value.

func (Net_SASLValidationError) Reason

func (e Net_SASLValidationError) Reason() string

Reason function returns reason value.

type Net_TLS

type Net_TLS struct {
	Enable   bool   `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	RootCa   string `protobuf:"bytes,2,opt,name=rootCa,proto3" json:"rootCa,omitempty"`
	Jks      string `protobuf:"bytes,3,opt,name=jks,proto3" json:"jks,omitempty"`
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	Cert     string `protobuf:"bytes,5,opt,name=cert,proto3" json:"cert,omitempty"`
	Key      string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*Net_TLS) Descriptor deprecated

func (*Net_TLS) Descriptor() ([]byte, []int)

Deprecated: Use Net_TLS.ProtoReflect.Descriptor instead.

func (*Net_TLS) GetCert

func (x *Net_TLS) GetCert() string

func (*Net_TLS) GetEnable

func (x *Net_TLS) GetEnable() bool

func (*Net_TLS) GetJks

func (x *Net_TLS) GetJks() string

func (*Net_TLS) GetKey

func (x *Net_TLS) GetKey() string

func (*Net_TLS) GetPassword

func (x *Net_TLS) GetPassword() string

func (*Net_TLS) GetRootCa

func (x *Net_TLS) GetRootCa() string

func (*Net_TLS) ProtoMessage

func (*Net_TLS) ProtoMessage()

func (*Net_TLS) ProtoReflect

func (x *Net_TLS) ProtoReflect() protoreflect.Message

func (*Net_TLS) Reset

func (x *Net_TLS) Reset()

func (*Net_TLS) String

func (x *Net_TLS) String() string

func (*Net_TLS) Validate

func (m *Net_TLS) Validate() error

Validate checks the field values on Net_TLS with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Net_TLS) ValidateAll added in v0.0.8

func (m *Net_TLS) ValidateAll() error

ValidateAll checks the field values on Net_TLS with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in Net_TLSMultiError, or nil if none found.

type Net_TLSMultiError added in v0.0.8

type Net_TLSMultiError []error

Net_TLSMultiError is an error wrapping multiple validation errors returned by Net_TLS.ValidateAll() if the designated constraints aren't met.

func (Net_TLSMultiError) AllErrors added in v0.0.8

func (m Net_TLSMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (Net_TLSMultiError) Error added in v0.0.8

func (m Net_TLSMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type Net_TLSValidationError

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

Net_TLSValidationError is the validation error returned by Net_TLS.Validate if the designated constraints aren't met.

func (Net_TLSValidationError) Cause

func (e Net_TLSValidationError) Cause() error

Cause function returns cause value.

func (Net_TLSValidationError) Error

func (e Net_TLSValidationError) Error() string

Error satisfies the builtin error interface

func (Net_TLSValidationError) ErrorName

func (e Net_TLSValidationError) ErrorName() string

ErrorName returns error name.

func (Net_TLSValidationError) Field

func (e Net_TLSValidationError) Field() string

Field function returns field value.

func (Net_TLSValidationError) Key

func (e Net_TLSValidationError) Key() bool

Key function returns key value.

func (Net_TLSValidationError) Reason

func (e Net_TLSValidationError) Reason() string

Reason function returns reason value.

type Producer

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

Producer 生产者

func NewProducer

func NewProducer(c *Conf) (*Producer, error)

func (*Producer) Close

func (p *Producer) Close() error

func (*Producer) Name

func (p *Producer) Name() string

func (*Producer) Push

func (p *Producer) Push(ctx context.Context, topic string, key, value []byte) error

type Pusher added in v0.0.39

type Pusher interface {
	Name() string
	Push(ctx context.Context, topic string, key, value []byte) error
	Close() error
}

A Pusher interface wraps the method Push.

func MustNewProducer

func MustNewProducer(c *Conf) Pusher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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