gmq

package module
v0.0.0-...-6abec64 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 8 Imported by: 0

README

gmq

the message queue of go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker 实现优雅退出

func NewBroker

func NewBroker() *Broker

func (*Broker) Close

func (b *Broker) Close()

func (*Broker) Listen

func (b *Broker) Listen()

Listen 监听信号

func (*Broker) Send

func (b *Broker) Send(m *Msg) error

func (*Broker) Subscribe

func (b *Broker) Subscribe(topic string, capacity int) (<-chan *Msg, error)

func (*Broker) Use

func (b *Broker) Use(middlewares ...Middleware)

type BrokerOption

type BrokerOption func(*Broker)

func WithShutdownCallbacks

func WithShutdownCallbacks(cbs ...ShutdownCallback) BrokerOption

type HandleFunc

type HandleFunc func(msg *Msg) error

type MessageQueue

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

func (*MessageQueue) Close

func (b *MessageQueue) Close() error

func (*MessageQueue) Send

func (b *MessageQueue) Send(m *Msg) error

func (*MessageQueue) Subscribe

func (b *MessageQueue) Subscribe(topic string, capacity int) (<-chan *Msg, error)

type Middleware

type Middleware func(handleFunc HandleFunc) HandleFunc

type Msg

type Msg struct {
	Topic   string
	Content string
}

type ShutdownCallback

type ShutdownCallback func(ctx context.Context)

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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