rabbitmq

package
v0.0.0-...-22fb2a0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MQType = "rabbitmq"
)

Variables

This section is empty.

Functions

func RabbitMQServiceFactory

func RabbitMQServiceFactory(rawConfig map[string]string) (mq.MQService, error)

Types

type ChannelType

type ChannelType string
const (
	Direct ChannelType = "direct"
	PubSub ChannelType = "pub_sub"
	Delay  ChannelType = "delay"
)

type Config

type Config struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	AutoACK  bool   `yaml:"auto_ack"`

	QueueName    string      `yaml:"queue"`    // 可为空,代表生成一个no-durable的队列,名字由系统给定
	ExchangeName string      `yaml:"exchange"` // 可为空,若为空则不会使用exchange,而是往queue中直接发送;pubsub和delay必须指定
	Type         ChannelType `yaml:"type"`     // direct/pub_sub/delay

	// aliyun
	Endpoint        string `yaml:"endpoint"`
	AccessKey       string `yaml:"access_key"`
	SecretKey       string `yaml:"secret_key"`
	InstanceID      string `yaml:"instance_id"`
	ConsumerGroupID string `yaml:"consumer_group_id"`
}

type RabbitMQService

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

func (*RabbitMQService) Connect

func (s *RabbitMQService) Connect() error

func (*RabbitMQService) DelaySend

func (s *RabbitMQService) DelaySend(topic string, msg []byte, handleTime time.Time) (msgID string, err error)

func (*RabbitMQService) RegisterHandler

func (s *RabbitMQService) RegisterHandler(topic string, handler mq.MQMsgHandler)

func (*RabbitMQService) Send

func (s *RabbitMQService) Send(topic string, msg []byte) (msgID string, err error)

Jump to

Keyboard shortcuts

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