kafka

package
v0.0.0-...-062f787 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MqMessageHeaderId      = 0x12345678
	MqMessageAesEncryptKey = "1234567890123456"
	CrcLen                 = 4
)
View Source
const (
	RedisIpPort = "localhost:6379"
)

Variables

This section is empty.

Functions

func AsyncProducer

func AsyncProducer(addrs []string, topic string) error

func Consumer1

func Consumer1(addrs []string) error

func Consumer2

func Consumer2(addrs []string, groupID string, topics []string) error

func PackData

func PackData(data []byte) ([]byte, error)

func SyncProducer

func SyncProducer(addrs []string, topic string) error

func UnpackData

func UnpackData(packedData []byte) ([]byte, error)

Types

type Consumer

type Consumer struct {
	ConsumerHigh sarama.Consumer
	Addrs        []string
	Topic        string
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer(addrs []string, topic string) (*Consumer, error)

func (*Consumer) Close

func (c *Consumer) Close()

func (*Consumer) Partitions

func (c *Consumer) Partitions() ([]int32, error)

func (*Consumer) Read

func (c *Consumer) Read(partition int32) ([]byte, error)

type KafkaMq

type KafkaMq struct {
}

func (*KafkaMq) Register

func (ka *KafkaMq) Register() error

type MqMessageHeader

type MqMessageHeader struct {
	MqMessageHeaderID uint32
	DataLength        uint32
}

type Producer

type Producer struct {
	AsyncProducer sarama.AsyncProducer
	Addrs         []string
	Topic         string
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(addrs []string, topic string) (*Producer, error)

func (*Producer) Close

func (p *Producer) Close()

func (*Producer) Send

func (p *Producer) Send(partition int32, data []byte) error

Jump to

Keyboard shortcuts

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