mqwrap

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TopicChannelType topic交换机
	TopicChannelType = channelType(1)
	// FanoutChannelType fanout 交换机
	FanoutChannelType = channelType(2)
	// WorkerChannelType Worker交换机
	WorkerChannelType = channelType(3)
)

Variables

View Source
var (
	Opts = &struct {
		Host     string
		Account  string
		Password string
	}{}

	Flags = []cli.Flag{
		&cli.StringFlag{
			Name:        "MQHOST",
			Value:       "127.0.0.1:5672/xw-debug",
			Usage:       "-MQHOST 127.0.0.1",
			EnvVars:     []string{"MQHOST"},
			Destination: &Opts.Host,
		},
		&cli.StringFlag{
			Name:        "MQACCOUNT",
			Value:       "xw",
			Usage:       "-MQACCOUNT guest",
			EnvVars:     []string{"MQACCOUNT"},
			Destination: &Opts.Account,
		},
		&cli.StringFlag{
			Name:        "MQPASSWORD",
			Value:       "123456",
			Usage:       "-MQPASSWORD guest",
			EnvVars:     []string{"MQPASSWORD"},
			Destination: &Opts.Password,
		},
	}
)

Functions

func Startup

func Startup()

Types

type Delivery

type Delivery = amqp.Delivery

type MqChannel

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

MqChannel 通道

func NewChannel

func NewChannel(kind channelType, name string) (*MqChannel, error)

NewChannel 生成通道

func (*MqChannel) Close

func (c *MqChannel) Close()

Close 关闭

func (*MqChannel) Publish

func (c *MqChannel) Publish(key string, msg []byte) error

Publish 广播

func (*MqChannel) Receive

func (c *MqChannel) Receive(reader func(value Delivery)) error

Receive 接受

func (*MqChannel) Subscribe

func (c *MqChannel) Subscribe(key string) error

Subscribe 订阅

func (*MqChannel) Unsubscribe

func (c *MqChannel) Unsubscribe(key string) error

Unsubscribe 取消订阅

Jump to

Keyboard shortcuts

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