kafka

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallMiddleware added in v1.8.4

func InstallMiddleware(handle ...ProducerHandler)

InstallMiddleware Install the middleware.. You can control the publishing of messages by installing middleware.

Types

type Consumer

type Consumer interface {
	// Start pass in the relevant address, configuration.
	Start(addrs []string, groupID string, config *sarama.Config, proxyAddr string, proxyH2C bool)
	// Restart the connection.
	Restart() error
	// Close the connection.
	Close() error
	// Set the limit flow per second.
	SetRateLimit(rate int)
	// Set the HTTP agent to time out.
	SetProxyTimeout(time.Duration)
	// SetSerializable .
	SetSerializable()
}

Consumer Kafka Consumer interface definition.

func GetConsumer added in v1.8.8

func GetConsumer() Consumer

GetConsumer Returns the Consumer instance.

type ConsumerImpl added in v1.8.8

type ConsumerImpl struct {
	freedom.Infra
	// contains filtered or unexported fields
}

ConsumerImpl Kafka Consumer implementation.

func (*ConsumerImpl) Booting added in v1.8.8

func (c *ConsumerImpl) Booting(bootManager freedom.BootManager)

Booting The method of overriding the component . The single-case component initiates a callback.

func (*ConsumerImpl) Close added in v1.8.8

func (c *ConsumerImpl) Close() error

Close the connection.

func (*ConsumerImpl) Restart added in v1.8.8

func (c *ConsumerImpl) Restart() error

Restart the connection.

func (*ConsumerImpl) SetProxyTimeout added in v1.8.9

func (c *ConsumerImpl) SetProxyTimeout(timeout time.Duration)

SetProxyTimeout Set the HTTP agent to time out.

func (*ConsumerImpl) SetRateLimit added in v1.8.9

func (c *ConsumerImpl) SetRateLimit(rate int)

SetRateLimit Set the limit flow per second.

func (*ConsumerImpl) SetSerializable added in v1.9.0

func (c *ConsumerImpl) SetSerializable()

SetSerializable .

func (*ConsumerImpl) Start added in v1.8.8

func (c *ConsumerImpl) Start(addrs []string, groupID string, config *sarama.Config, proxyAddr string, proxyH2C bool)

Start pass in the relevant address, configuration.

type Msg

type Msg struct {
	Topic string

	Content []byte
	// contains filtered or unexported fields
}

Msg Kafka Message.

func (*Msg) GetExecution added in v1.8.4

func (msg *Msg) GetExecution() error

GetExecution Get the results of the execution .

func (*Msg) GetHeader added in v1.8.4

func (msg *Msg) GetHeader() map[string]interface{}

GetHeader .

func (*Msg) GetMessageKey added in v1.8.4

func (msg *Msg) GetMessageKey() string

GetMessageKey Get kafka key.

func (*Msg) IsStopped added in v1.8.4

func (msg *Msg) IsStopped() bool

IsStopped whether it has stopped.

func (*Msg) Next added in v1.8.4

func (msg *Msg) Next()

Next Perform the next step, typically for the control of middleware.

func (*Msg) Publish added in v1.3.5

func (msg *Msg) Publish() error

Publish this message.

func (*Msg) SetHeader added in v1.8.4

func (msg *Msg) SetHeader(head map[string]interface{}) *Msg

SetHeader set up HTTP Header.

func (*Msg) SetMessageKey added in v1.8.4

func (msg *Msg) SetMessageKey(key string) *Msg

SetMessageKey Set kafka key.

func (*Msg) Stop added in v1.8.4

func (msg *Msg) Stop() *Msg

Stop execution, typically used for middleware control

type Producer

type Producer interface {
	// Create a new message
	NewMsg(topic string, content []byte) *Msg
	// Start pass in the relevant address, configuration.
	Start(addrs []string, config *sarama.Config)
	// Restart the connection.
	Restart() error
}

Producer The producer's interface definition.

func GetProducer added in v1.8.8

func GetProducer() Producer

GetProducer Gets an instance of the producer.

type ProducerHandler added in v1.8.4

type ProducerHandler func(*Msg)

ProducerHandler The function declaration of the Kafka Producer middleware..

type ProducerImpl added in v1.4.3

type ProducerImpl struct {
	freedom.Infra
	// contains filtered or unexported fields
}

ProducerImpl The realization of the producer.

func (*ProducerImpl) Booting added in v1.4.3

func (pi *ProducerImpl) Booting(bootManager freedom.BootManager)

Booting The method of overriding the component . The single-case component initiates a callback.

func (*ProducerImpl) Close added in v1.8.8

func (pi *ProducerImpl) Close() error

Close .

func (*ProducerImpl) NewMsg added in v1.4.3

func (pi *ProducerImpl) NewMsg(topic string, content []byte) *Msg

NewMsg Create a new message.

func (*ProducerImpl) Restart added in v1.8.8

func (pi *ProducerImpl) Restart() error

Restart the connection.

func (*ProducerImpl) Start added in v1.8.8

func (pi *ProducerImpl) Start(addrs []string, config *sarama.Config)

Start pass in the relevant address, configuration.

Jump to

Keyboard shortcuts

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