amqp

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: 4 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 (
	RabbitmqConn *amqp.Connection
)

Functions

This section is empty.

Types

type Amqp

type Amqp interface {
	Init(opts ...Option)
	Options() Options
}

type Channel

type Channel interface {
	Init(opts ...Option)
	Options() Options
	Publish(msg []byte)
	Consume(msg []byte)
}

type ChannelOptions

type ChannelOptions struct {
	RabbitmqURL string
}

type Config

type Config struct {
}

type Connection

type Connection interface {
	Init(opts ...Option)
	Options() Options
	Reconnect() error
}

type Consumer

type Consumer interface {
	Init(...ConsumerOption) error
	Options() ConsumerOptions
	Shutdown() error
}

type ConsumerHandle

type ConsumerHandle func(delivery Delivery, done chan error)

type ConsumerOption

type ConsumerOption func(*ConsumerOptions)

type ConsumerOptions

type ConsumerOptions struct {
	Uri string

	Tag     string
	Key     string
	Handle  ConsumerHandle
	Conn    *amqp.Connection
	Channel *amqp.Channel
	// contains filtered or unexported fields
}

type Delivery

type Delivery = amqp.Delivery

type MqChannel

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

func NewChannel

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

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 取消订阅

type Option

type Option func(*Options)

type Options

type Options struct {
	Url  string
	Conn *amqp.Connection
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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