mq

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var List = fastapi.List

Functions

func AsyncPostProducerMessage added in v0.3.7

func AsyncPostProducerMessage(c *fastapi.Context) *fastapi.Response

AsyncPostProducerMessage 异步生产消息

func EdgeRouter added in v0.3.7

func EdgeRouter() *fastapi.Router

EdgeRouter edge路由组

func PostProducerMessage added in v0.3.7

func PostProducerMessage(c *fastapi.Context) *fastapi.Response

PostProducerMessage 同步发送消息

func StatRouter added in v0.3.7

func StatRouter() *fastapi.Router

Types

type Config

type Config struct {
	AppName           string         `json:"app_name"`
	Version           string         `json:"version"`
	EdgeHttpHost      string         `json:"edge_http_host"`     // http api 接口服务
	EdgeHttpPort      string         `json:"edge_http_port"`     //
	EdgeEnabled       bool           `json:"edge_enabled"`       // 是否开启基于Http的消息publisher功能
	Debug             bool           `json:"debug"`              // 调试模式开关
	SwaggerDisabled   bool           `json:"swagger_disabled"`   // 禁用调试文档
	StatisticDisabled bool           `json:"statistic_disabled"` // 禁用统计功能
	Broker            *engine.Config `json:"broker"`             //
	// contains filtered or unexported fields
}

func DefaultConf

func DefaultConf() Config

type ConsumerStatistic added in v0.3.7

type ConsumerStatistic struct {
	fastapi.BaseModel
	Addr   string   `json:"addr" description:"连接地址"`
	Topics []string `json:"topics" description:"订阅的主题名列表"`
}

func (*ConsumerStatistic) SchemaDesc added in v0.3.7

func (m *ConsumerStatistic) SchemaDesc() string

type CoreEventHandler added in v0.3.2

type CoreEventHandler struct {
	engine.DefaultEventHandler
}

func (CoreEventHandler) OnConsumerClosed added in v0.3.2

func (e CoreEventHandler) OnConsumerClosed(_ string)

func (CoreEventHandler) OnConsumerRegister added in v0.3.2

func (e CoreEventHandler) OnConsumerRegister(_ string)

func (CoreEventHandler) OnProducerClosed added in v0.3.2

func (e CoreEventHandler) OnProducerClosed(_ string)

func (CoreEventHandler) OnProducerRegister added in v0.3.2

func (e CoreEventHandler) OnProducerRegister(_ string)

type MQ

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

func New

func New(cs ...Config) *MQ

func (*MQ) Config added in v0.3.3

func (m *MQ) Config() any

func (*MQ) Ctx added in v0.3.1

func (m *MQ) Ctx() context.Context

Ctx 获取根context

func (*MQ) Logger added in v0.3.1

func (m *MQ) Logger() logger.Iface

func (*MQ) Serve added in v0.3.1

func (m *MQ) Serve()

Serve 阻塞启动

func (*MQ) SetCrypto added in v0.3.4

func (m *MQ) SetCrypto(crypto proto.Crypto) *MQ

SetCrypto 设置加解密器

func (*MQ) SetCryptoPlan added in v0.3.4

func (m *MQ) SetCryptoPlan(option string, key ...string) *MQ

SetCryptoPlan 修改加密方案

func (*MQ) SetLogger added in v0.3.1

func (m *MQ) SetLogger(logger logger.Iface) *MQ

func (*MQ) Stat added in v0.3.7

func (m *MQ) Stat() *engine.Statistic

Stat 获取统计信息类

func (*MQ) Stop

func (m *MQ) Stop()

type ProducerForm added in v0.3.7

type ProducerForm struct {
	fastapi.BaseModel
	Token string `json:"token,omitempty" description:"认证密钥"`
	Topic string `json:"topic" description:"消息主题"`
	Key   string `json:"key" description:"消息键"`
	Value string `json:"value" description:"base64编码后的消息体"`
}

func (*ProducerForm) IsEncrypt added in v0.3.7

func (m *ProducerForm) IsEncrypt() bool

func (*ProducerForm) SchemaDesc added in v0.3.7

func (m *ProducerForm) SchemaDesc() string

func (*ProducerForm) String added in v0.3.7

func (m *ProducerForm) String() string

type ProductResponse added in v0.3.7

type ProductResponse struct {
	fastapi.BaseModel
	// 仅当 Accepted 时才认为服务器接受了请求并下方了有效的参数
	Status       string `` /* 126-byte string literal not displayed */
	Offset       uint64 `json:"offset" description:"消息偏移量"`
	ResponseTime int64  `json:"response_time" description:"服务端返回消息时的时间戳"`
	Message      string `json:"message" description:"额外的消息描述"`
}

func (*ProductResponse) SchemaDesc added in v0.3.7

func (m *ProductResponse) SchemaDesc() string

func (*ProductResponse) String added in v0.3.7

func (m *ProductResponse) String() string

type TopicConsumerStatistic added in v0.3.7

type TopicConsumerStatistic struct {
	fastapi.BaseModel
	Topic     string   `json:"topic" description:"名称"`
	Consumers []string `json:"consumers" description:"消费者连接"`
}

type TopicOffsetStatistic added in v0.3.7

type TopicOffsetStatistic struct {
	fastapi.BaseModel
	Topic  string `json:"topic" description:"名称"`
	Offset uint64 `json:"offset" description:"最新的消息偏移量"`
}

func (*TopicOffsetStatistic) SchemaDesc added in v0.3.7

func (m *TopicOffsetStatistic) SchemaDesc() string

type TopicRecordStatistic added in v0.3.7

type TopicRecordStatistic struct {
	fastapi.BaseModel
	Topic       string `json:"topic" description:"名称"`
	Key         string `json:"key"`
	Value       string `json:"value" description:"base64编码后的消息体明文"`
	Offset      uint64 `json:"offset" description:"消息偏移量"`
	ProductTime int64  `json:"product_time" description:"消息接收时间戳"`
}

Jump to

Keyboard shortcuts

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