Documentation ¶
Overview ¶
共享订阅
系统主题
共享订阅
Index ¶
- Constants
- Variables
- func NewMemProvider() *memTopics
- func Register(name string, provider SysTopicsProvider)
- func SysTopicInit()
- func Unregister(name string)
- type Manager
- func (this *Manager) Close() error
- func (this *Manager) Retain(msg *messagev5.PublishMessage) error
- func (this *Manager) Retained(topic []byte, msgs *[]*messagev5.PublishMessage) error
- func (this *Manager) Subscribe(topic []byte, qos byte, subscriber interface{}) (byte, error)
- func (this *Manager) Subscribers(topic []byte, qos byte, subs *[]interface{}, qoss *[]byte) error
- func (this *Manager) Unsubscribe(topic []byte, subscriber interface{}) error
- type SysTopicsProvider
Constants ¶
View Source
const ( // MWC is the multi-level wildcard MWC = "#" // SWC is the single level wildcard SWC = "+" // SEP is the topic level separator SEP = "/" // SYS is the starting character of the system level topics //SYS是系统级主题的起始字符 SYS = "$" )
Variables ¶
View Source
var ( // ErrAuthFailure is returned when the user/pass supplied are invalid ErrAuthFailure = errors.New("auth: Authentication failure") // ErrAuthProviderNotFound is returned when the requested provider does not exist. // It probably hasn't been registered yet. ErrAuthProviderNotFound = errors.New("auth: Authentication provider not found") )
View Source
var Default = "default"
View Source
var ( // MaxQosAllowed is the maximum QOS supported by this server MaxQosAllowed_redis = messagev5.QosExactlyOnce )
Functions ¶
func NewMemProvider ¶
func NewMemProvider() *memTopics
NewMemProvider returns an new instance of the memTopics, which is implements the TopicsProvider interface. memProvider is a hidden struct that stores the topic subscriptions and retained messages in memory. The content is not persistend so when the server goes, everything will be gone. Use with care.
func Register ¶
func Register(name string, provider SysTopicsProvider)
func SysTopicInit ¶
func SysTopicInit()
func Unregister ¶
func Unregister(name string)
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Retained ¶
func (this *Manager) Retained(topic []byte, msgs *[]*messagev5.PublishMessage) error
func (*Manager) Subscribers ¶
func (*Manager) Unsubscribe ¶
type SysTopicsProvider ¶
type SysTopicsProvider interface { Subscribe(topic []byte, qos byte, subscriber interface{}) (byte, error) Unsubscribe(topic []byte, subscriber interface{}) error Subscribers(topic []byte, qos byte, subs *[]interface{}, qoss *[]byte) error Retain(msg *messagev5.PublishMessage) error Retained(topic []byte, msgs *[]*messagev5.PublishMessage) error Close() error }
TopicsProvider
Click to show internal directories.
Click to hide internal directories.