mq

package
Version: v0.0.0-...-0864a4c Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerFunc

type ConsumerFunc func(*Msg)

type GoRoutineMQ

type GoRoutineMQ struct {
	ConsumerMap map[uint32]ConsumerFunc
}

func SetupGoRoutineMQ

func SetupGoRoutineMQ(consumerMap map[uint32]ConsumerFunc) (*GoRoutineMQ, error)

func (*GoRoutineMQ) Close

func (mq *GoRoutineMQ) Close()

func (*GoRoutineMQ) Consume

func (mq *GoRoutineMQ) Consume(consumerMap map[uint32]ConsumerFunc) error

func (*GoRoutineMQ) Publish

func (mq *GoRoutineMQ) Publish(msg *Msg) error

type MQ

type MQ interface {
	Close()
	Publish(msg *Msg) error
	Consume(consumerMap map[uint32]ConsumerFunc) error
}

type Msg

type Msg struct {
	Code    uint32 // for type
	Payload []byte
}

type RabbitMQ

type RabbitMQ struct {
	Conn     *amqp.Connection
	Settings *Settings
}

func SetupRabbitMQ

func SetupRabbitMQ(settings *Settings) (*RabbitMQ, error)

func (*RabbitMQ) Close

func (mq *RabbitMQ) Close()

func (*RabbitMQ) Consume

func (mq *RabbitMQ) Consume(consumerMap map[uint32]ConsumerFunc) error

func (*RabbitMQ) Publish

func (mq *RabbitMQ) Publish(msg *Msg) error

type Settings

type Settings struct {
	Host       string `yaml:"host"`
	Username   string `yaml:"username"`
	Password   string `yaml:"password"`
	VHost      string `yaml:"vhost"`
	Exchange   string `yaml:"exchange"`
	Queue      string `yaml:"queue"`
	RoutingKey string `yaml:"routing-key"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL