rabbitmq

package
v0.0.0-...-60952ad Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewListener

func MustNewListener(listenerConf RabbitListenerConf, handler ConsumeHandler) queue.MessageQueue

Types

type Admin

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

func MustNewAdmin

func MustNewAdmin(rabbitMqConf RabbitConf) *Admin

func (*Admin) Bind

func (q *Admin) Bind(queueName string, routekey string, exchange string, notWait bool, args amqp.Table) error

func (*Admin) DeclareExchange

func (q *Admin) DeclareExchange(conf ExchangeConf, args amqp.Table) error

func (*Admin) DeclareQueue

func (q *Admin) DeclareQueue(conf QueueConf, args amqp.Table) error

type ConsumeHandle

type ConsumeHandle func(message string) error

type ConsumeHandler

type ConsumeHandler interface {
	Consume(message string) error
}

type ConsumerConf

type ConsumerConf struct {
	Name      string
	AutoAck   bool `json:",default=true"`
	Exclusive bool `json:",default=false"`
	// Set to true, which means that messages sent by producers in the same connection
	// cannot be delivered to consumers in this connection.
	NoLocal bool `json:",default=false"`
	// Whether to block processing
	NoWait bool `json:",default=false"`
}

type ExchangeConf

type ExchangeConf struct {
	ExchangeName string
	Type         string `json:",options=direct|fanout|topic|headers"` // exchange type
	Durable      bool   `json:",default=true"`
	AutoDelete   bool   `json:",default=false"`
	Internal     bool   `json:",default=false"`
	NoWait       bool   `json:",default=false"`
	Queues       []QueueConf
}

type QueueConf

type QueueConf struct {
	Name       string
	Durable    bool `json:",default=true"`
	AutoDelete bool `json:",default=false"`
	Exclusive  bool `json:",default=false"`
	NoWait     bool `json:",default=false"`
}

type RabbitConf

type RabbitConf struct {
	Username string
	Password string
	Host     string
	Port     int
	VHost    string `json:",optional"`
}

type RabbitListener

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

func (RabbitListener) Start

func (q RabbitListener) Start()

func (RabbitListener) Stop

func (q RabbitListener) Stop()

type RabbitListenerConf

type RabbitListenerConf struct {
	RabbitConf
	ListenerQueues []ConsumerConf
}

type RabbitMqSender

type RabbitMqSender struct {
	ContentType string
	// contains filtered or unexported fields
}

func (*RabbitMqSender) Send

func (q *RabbitMqSender) Send(exchange string, routeKey string, msg []byte) error

type RabbitSenderConf

type RabbitSenderConf struct {
	RabbitConf
	ContentType string `json:",default=text/plain"` // MIME content type
}

type Sender

type Sender interface {
	Send(exchange string, routeKey string, msg []byte) error
}

func MustNewSender

func MustNewSender(rabbitMqConf RabbitSenderConf) Sender

Jump to

Keyboard shortcuts

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