mq

package
v1.20.57 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Zlib Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConOk   = Status(0)
	ConFail = Status(1)
)
View Source
const (
	ConTypePush = Type(0)
	ConTypePull = Type(1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	GroupID      string `json:"groupId" yaml:"groupId" xml:"groupId"`
	Server       string `json:"server" yaml:"server" xml:"server"`
	Domain       string `json:"domain" yaml:"domain" xml:"domain"`
	GroupName    string `json:"groupName" yaml:"groupName" xml:"groupName"`
	InstanceName string `json:"instance" yaml:"instance" xml:"instance"`
}

type Config

type Config struct {
	Client       ClientConfig   `json:"client" yaml:"client" xml:"client"`
	Credentials  Credentials    `json:"credentials" yaml:"credentials" xml:"credentials"`
	LogLevel     int            `json:"logLevel" yaml:"logLevel" xml:"logLevel"`
	ProducerConf ProducerConfig `json:"producer" yaml:"producer" xml:"producer"`
	ConsumerConf ConsumerConfig `json:"consumer" yaml:"consumer" xml:"consumer"`
}

type Consumer

type Consumer interface {
	Start() error

	Stop()

	//Subscribe 建议外面使用 go goroutine
	Subscribe(topic Topic, exp Expression, call func(msg *Message) Status) error
}

func NewConsumer

func NewConsumer(con Type, cfg Config) Consumer

func NewPullConsumer

func NewPullConsumer(cfg Config) Consumer

func NewPushConsumer

func NewPushConsumer(cfg Config) Consumer

type ConsumerConfig

type ConsumerConfig struct {
	ThreadCount int `json:"threadCount" yaml:"threadCount" xml:"threadCount"`
	Model       int `json:"model" yaml:"model" xml:"model"`
	Size        int `json:"size" yaml:"size" xml:"size"`
}

type Credentials

type Credentials struct {
	AccessKey   string `json:"accessKey" yaml:"accessKey" xml:"accessKey"`
	SecretKey   string `json:"secretKey" yaml:"secretKey" xml:"secretKey"`
	SecretToken string `json:"secretToken" yaml:"secretToken" xml:"secretToken"`
}

type Expression

type Expression struct {
	Type string
	Exp  string
}

type Message

type Message struct {
	MsgId    string
	QueueId  int
	Topic    string
	Tags     string
	Keys     string
	Body     string
	Property map[string]string
}

type Producer

type Producer interface {
	Start() error

	Stop()

	SendJson(topic string, event interface{}) error

	SendBytes(topic string, data []byte) error

	SendAsync(topic string, data []byte) error
}

func NewProducer

func NewProducer(cfg Config) Producer

type ProducerConfig

type ProducerConfig struct {
	Timeout  int `json:"timeout" yaml:"timeout" xml:"timeout"`
	Compress int `json:"compress" yaml:"compress" xml:"compress"`
	Size     int `json:"size" yaml:"size" xml:"size"`
	Retry    int `json:"retry" yaml:"retry" xml:"retry"`
}

type Status

type Status int

type Topic

type Topic struct {
	Topic      string
	BrokerName string
	QueueId    int
}

type Type

type Type int

Jump to

Keyboard shortcuts

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