Documentation
¶
Index ¶
- Constants
- func CreateNewConsumer(addressSet []string, consumerGroupTopic map[string]ConsumeTopic, ...) *consumer
- func PrintJSONMessage(msg *sarama.ConsumerMessage) error
- func PrintProtoMessage(msg *sarama.ConsumerMessage) error
- func PrintSimpleMSG(msg *sarama.ConsumerMessage) error
- func PrintStringMessage(msg *sarama.ConsumerMessage) error
- func String2Stamp(t *string) *int64
- func TypeConvert(tableName, columnName, value string, sqlType int32, mysqlType string) interface{}
- type CommonMessage
- type ConsumeTopic
- type Message
Constants ¶
View Source
const CommonMSGSerialVersionUID int64 = 2611556444074013268
Variables ¶
This section is empty.
Functions ¶
func CreateNewConsumer ¶
func CreateNewConsumer(addressSet []string, consumerGroupTopic map[string]ConsumeTopic, consumerConfig *sarama.Config) *consumer
创建消费者对象 addressSet: kafka地址集合 consumerGroupTopic: 消费者组信息 consumerConfig: 消费者配置信息,如果为空就采用默认的配置
func PrintJSONMessage ¶
func PrintJSONMessage(msg *sarama.ConsumerMessage) error
func PrintProtoMessage ¶
func PrintProtoMessage(msg *sarama.ConsumerMessage) error
func PrintSimpleMSG ¶
func PrintSimpleMSG(msg *sarama.ConsumerMessage) error
func PrintStringMessage ¶
func PrintStringMessage(msg *sarama.ConsumerMessage) error
func String2Stamp ¶
func TypeConvert ¶
Types ¶
type CommonMessage ¶
type CommonMessage struct {
Database string // 数据库或schema
Table string // 表名
PkNames []string // 主键名列表
IsDdl bool // 是否是DDL操作
Type string // 类型:INSERT/UPDATE/DELETE
Es int64 // binlog执行时间,执行耗时
Ts int64 // DML构建时间戳,同步时间
SQL string // 执行的SQL,DML SQL为空
Data []map[string]interface{} // 数据列表
Old []map[string]interface{} // 旧数据列表,用于更新,size和data的size一一对应
}
func Convert ¶
func Convert(msg *Message) ([]*CommonMessage, error)
func (*CommonMessage) Clear ¶
func (c *CommonMessage) Clear()
func (*CommonMessage) GetCreatedTime ¶
func (c *CommonMessage) GetCreatedTime() []time.Time
func (*CommonMessage) GetId ¶
func (c *CommonMessage) GetId() int
func (*CommonMessage) GetUpdatedTime ¶
func (c *CommonMessage) GetUpdatedTime() []time.Time
func (*CommonMessage) String ¶
func (c *CommonMessage) String() string
type ConsumeTopic ¶
type ConsumeTopic struct {
//一个消费者组里包含几个消费者
ConsumeNum int
//消费者组监听的主题
Topics []string
//回调的Handler, 需要调用者自己实现
Callback sarama.ConsumerGroupHandler
}
type Message ¶
type Message struct {
// serialVersionUID uint64
ID int64
Entries []*protocal_message.Entry
Raw bool
RawEntries [][]byte
}
func NewMessage ¶
func NewMessage(id int64, entries []*protocal_message.Entry) *Message
func NewRawMessage ¶
func (*Message) AddEntry ¶
func (m *Message) AddEntry(entry *protocal_message.Entry)
func (*Message) AddRawEntry ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.