mmq

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

README

minimal_message_queue GoDoc

A simple in-memory message queue module in Go, based on tcp/json.

Features

TODO

  • EnableTLS
  • C/C++ binding library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	OnClientMsgRecv OnClientMsgRecv
	// contains filtered or unexported fields
}

Client 客户端

func NewClient

func NewClient(addr string) *Client

NewClient 启动客户端

func (*Client) Publish

func (c *Client) Publish(topic string, m *sjson.Json) error

Publish 客户端发布消息

func (*Client) SetOnMsgRecv

func (c *Client) SetOnMsgRecv(handler OnClientMsgRecv) *Client

func (*Client) SetTLS

func (c *Client) SetTLS(key, cert, ca []byte) *Client

SetTLS 设置TLS

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop()

func (*Client) Subscribe

func (c *Client) Subscribe(topics []string) error

Subscribe 客户端订阅主题

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(topics []string) error

Unsubscribe 客户端取消订阅主题

type MatchTopicFunc

type MatchTopicFunc func(pubtopic, subtopic string) bool

type OnClientMsgRecv

type OnClientMsgRecv func(c *Client, topic string, msg *sjson.Json, err error)

type Server

type Server struct {
	MatchTopicFunc MatchTopicFunc
	// contains filtered or unexported fields
}

Server 服务端

func NewServer

func NewServer(addr string) *Server

NewServer 创建并启动服务端

func (*Server) SetCluster

func (s *Server) SetCluster(addr string) *Server

func (*Server) SetMatchTopicFunc

func (s *Server) SetMatchTopicFunc(match MatchTopicFunc) *Server

func (*Server) SetTLS

func (s *Server) SetTLS(key, cert, ca []byte) *Server

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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