tmq

package
v3.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TMQSubscribe          = "subscribe"
	TMQPoll               = "poll"
	TMQFetch              = "fetch"
	TMQFetchBlock         = "fetch_block"
	TMQFetchJsonMeta      = "fetch_json_meta"
	TMQCommit             = "commit"
	TMQUnsubscribe        = "unsubscribe"
	TMQGetTopicAssignment = "assignment"
	TMQSeek               = "seek"
)

Variables

View Source
var ClosedErr = errors.New("connection closed")

Functions

This section is empty.

Types

type AssignmentReq added in v3.5.2

type AssignmentReq struct {
	ReqID uint64 `json:"req_id"`
	Topic string `json:"topic"`
}

type AssignmentResp added in v3.5.2

type AssignmentResp struct {
	Code       int              `json:"code"`
	Message    string           `json:"message"`
	Action     string           `json:"action"`
	ReqID      uint64           `json:"req_id"`
	Timing     int64            `json:"timing"`
	Assignment []tmq.Assignment `json:"assignment"`
}

type CommitReq

type CommitReq struct {
	ReqID     uint64 `json:"req_id"`
	MessageID uint64 `json:"message_id"`
}

type CommitResp

type CommitResp struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Action    string `json:"action"`
	ReqID     uint64 `json:"req_id"`
	Timing    int64  `json:"timing"`
	MessageID uint64 `json:"message_id"`
}

type Consumer

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

func NewConsumer

func NewConsumer(conf *tmq.ConfigMap) (*Consumer, error)

NewConsumer create a tmq consumer

func (*Consumer) Assignment added in v3.5.2

func (c *Consumer) Assignment() (partitions []tmq.TopicPartition, err error)

func (*Consumer) Close

func (c *Consumer) Close() error

Close consumer. This function can be called multiple times

func (*Consumer) Commit

func (c *Consumer) Commit() ([]tmq.TopicPartition, error)

func (*Consumer) Poll

func (c *Consumer) Poll(timeoutMs int) tmq.Event

Poll messages

func (*Consumer) Seek added in v3.5.2

func (c *Consumer) Seek(partition tmq.TopicPartition, ignoredTimeoutMs int) error

func (*Consumer) Subscribe

func (c *Consumer) Subscribe(topic string, rebalanceCb RebalanceCb) error

func (*Consumer) SubscribeTopics

func (c *Consumer) SubscribeTopics(topics []string, rebalanceCb RebalanceCb) error

func (*Consumer) Unsubscribe

func (c *Consumer) Unsubscribe() error

type FetchBlockReq

type FetchBlockReq struct {
	ReqID     uint64 `json:"req_id"`
	MessageID uint64 `json:"message_id"`
}

type FetchJsonMetaReq

type FetchJsonMetaReq struct {
	ReqID     uint64 `json:"req_id"`
	MessageID uint64 `json:"message_id"`
}

type FetchJsonMetaResp

type FetchJsonMetaResp struct {
	Code      int             `json:"code"`
	Message   string          `json:"message"`
	Action    string          `json:"action"`
	ReqID     uint64          `json:"req_id"`
	Timing    int64           `json:"timing"`
	MessageID uint64          `json:"message_id"`
	Data      json.RawMessage `json:"data"`
}

type FetchReq

type FetchReq struct {
	ReqID     uint64 `json:"req_id"`
	MessageID uint64 `json:"message_id"`
}

type FetchResp

type FetchResp struct {
	Code          int      `json:"code"`
	Message       string   `json:"message"`
	Action        string   `json:"action"`
	ReqID         uint64   `json:"req_id"`
	Timing        int64    `json:"timing"`
	MessageID     uint64   `json:"message_id"`
	Completed     bool     `json:"completed"`
	TableName     string   `json:"table_name"`
	Rows          int      `json:"rows"`
	FieldsCount   int      `json:"fields_count"`
	FieldsNames   []string `json:"fields_names"`
	FieldsTypes   []uint8  `json:"fields_types"`
	FieldsLengths []int64  `json:"fields_lengths"`
	Precision     int      `json:"precision"`
}

type IndexedChan

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

type OffsetSeekReq added in v3.5.2

type OffsetSeekReq struct {
	ReqID    uint64 `json:"req_id"`
	Topic    string `json:"topic"`
	VgroupID int32  `json:"vgroup_id"`
	Offset   int64  `json:"offset"`
}

type OffsetSeekResp added in v3.5.2

type OffsetSeekResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
}

type PollReq

type PollReq struct {
	ReqID        uint64 `json:"req_id"`
	BlockingTime int64  `json:"blocking_time"`
}

type PollResp

type PollResp struct {
	Code        int    `json:"code"`
	Message     string `json:"message"`
	Action      string `json:"action"`
	ReqID       uint64 `json:"req_id"`
	Timing      int64  `json:"timing"`
	HaveMessage bool   `json:"have_message"`
	Topic       string `json:"topic"`
	Database    string `json:"database"`
	VgroupID    int32  `json:"vgroup_id"`
	MessageType int32  `json:"message_type"`
	MessageID   uint64 `json:"message_id"`
	Offset      int64  `json:"offset"`
}

type RebalanceCb

type RebalanceCb func(*Consumer, tmq.Event) error

type SubscribeReq

type SubscribeReq struct {
	ReqID                uint64   `json:"req_id"`
	User                 string   `json:"user"`
	Password             string   `json:"password"`
	DB                   string   `json:"db"`
	GroupID              string   `json:"group_id"`
	ClientID             string   `json:"client_id"`
	OffsetRest           string   `json:"offset_rest"`
	Topics               []string `json:"topics"`
	AutoCommit           string   `json:"auto_commit"`
	AutoCommitIntervalMS string   `json:"auto_commit_interval_ms"`
	SnapshotEnable       string   `json:"snapshot_enable"`
	WithTableName        string   `json:"with_table_name"`
}

type SubscribeResp

type SubscribeResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
}

type UnsubscribeReq

type UnsubscribeReq struct {
	ReqID uint64 `json:"req_id"`
}

type UnsubscribeResp

type UnsubscribeResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
}

type WSError

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

func (*WSError) Error

func (e *WSError) Error() string

Jump to

Keyboard shortcuts

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