consumers

package
v0.0.0-...-0f8884b Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_RUNNING = iota << 1
	STATUS_STOPPED
)

Variables

This section is empty.

Functions

func GetOperationText

func GetOperationText(op dtsavro.Operation) string

Types

type Consumer

type Consumer struct {
	Name     string
	Config   *ConsumerConfig
	Consumer *cluster.Consumer
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer(config ConsumerConfig, q chan<- DtsData) (consumer *Consumer, err error)

func (*Consumer) GetName

func (c *Consumer) GetName() string

func (*Consumer) Shutdown

func (c *Consumer) Shutdown()

func (*Consumer) Start

func (c *Consumer) Start()

type ConsumerConfig

type ConsumerConfig struct {
	Name     string
	User     string
	Password string
	Broker   []string
	GroupId  string
	Topic    []string
}

func NewConfig

func NewConfig(broker, topic []string, groupid, user, password string) *ConsumerConfig

func (*ConsumerConfig) GetSASLUser

func (c *ConsumerConfig) GetSASLUser() string

type ConsumerGroup

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

func NewConsumerGroup

func NewConsumerGroup() (sg *ConsumerGroup)

func (*ConsumerGroup) GetConsumer

func (s *ConsumerGroup) GetConsumer(name string) *Consumer

func (*ConsumerGroup) GetQueue

func (s *ConsumerGroup) GetQueue() <-chan DtsData

func (*ConsumerGroup) Register

func (s *ConsumerGroup) Register(consumer *Consumer)

func (*ConsumerGroup) Shutdown

func (s *ConsumerGroup) Shutdown()

func (*ConsumerGroup) Watch

func (s *ConsumerGroup) Watch()

type DtsData

type DtsData struct {
	//数据源
	Consumer string `json:"consumer"`
	//表名
	Table string `json:"table"`
	//事件时间
	Datetime string `json:"datetime"`
	//字段信息
	Data []DtsValue `json:"data"`
	//变更字段列表
	Fields []string `json:"fields"`
	//数据库事件
	Operation string `json:"operation"`
}

type DtsValue

type DtsValue struct {
	Name      string `json:"name"`
	BeforeVal string `json:"before"`
	AfterVal  string `json:"after"`
}

type Group

type Group map[string]Consumer

Jump to

Keyboard shortcuts

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