rabbitmq

package module
v0.0.0-...-db56f6d Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

func (*Channel) Ack

func (this *Channel) Ack(tag uint64, multiple bool) error

func (*Channel) Cancel

func (this *Channel) Cancel(consumer string, noWait bool) error

func (*Channel) Close

func (this *Channel) Close() error

func (*Channel) Confirm

func (this *Channel) Confirm(noWait bool) error

func (*Channel) Consume

func (this *Channel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)

Consume

queue - 队列名称

consumer - 消费者名称

autoAck - 是否自动应答

exclusive - 是否独占

noLocal - 设置为 true,表示不能将同一个 Connection 中生产者发送的消息传递给这个 Connection 中的消费者

noWait - 是否阻塞

args - 其它参数

func (*Channel) ExchangeBind

func (this *Channel) ExchangeBind(destination, key, source string, noWait bool, args amqp.Table) error

func (*Channel) ExchangeDeclare

func (this *Channel) ExchangeDeclare(name string, kind string, durable bool, autoDelete bool, internal bool, noWait bool, args amqp.Table) error

func (*Channel) ExchangeDeclarePassive

func (this *Channel) ExchangeDeclarePassive(name string, kind string, durable bool, autoDelete bool, internal bool, noWait bool, args amqp.Table) error

func (*Channel) ExchangeDelete

func (this *Channel) ExchangeDelete(name string, ifUnused, noWait bool) error

func (*Channel) ExchangeUnbind

func (this *Channel) ExchangeUnbind(destination, key, source string, noWait bool, args amqp.Table) error

func (*Channel) Flow

func (this *Channel) Flow(active bool) error

func (*Channel) Get

func (this *Channel) Get(queue string, autoAck bool) (msg amqp.Delivery, ok bool, err error)

func (*Channel) GetNextPublishSeqNo

func (this *Channel) GetNextPublishSeqNo() uint64

func (*Channel) IsClosed

func (this *Channel) IsClosed() bool

func (*Channel) Nack

func (this *Channel) Nack(tag uint64, multiple bool, requeue bool) error

func (*Channel) OnCancel

func (this *Channel) OnCancel(handler func(c string))

func (*Channel) OnClose

func (this *Channel) OnClose(handler func(err *amqp.Error))

func (*Channel) OnFlow

func (this *Channel) OnFlow(handler func(c bool))

func (*Channel) OnPublish

func (this *Channel) OnPublish(handler func(c amqp.Confirmation))

func (*Channel) OnReconnect

func (this *Channel) OnReconnect(handler func(channel *Channel))

func (*Channel) OnReturn

func (this *Channel) OnReturn(handler func(r amqp.Return))

func (*Channel) Publish

func (this *Channel) Publish(exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing) error

Publish

exchange - 交换机名称

key - Key

mandatory - 如果为 true,根据自身 exchange 类型和 route key 规则无法找到符合条件的队列会把消息返还给发送者

immediate - 如果为 true,当 exchange 发送消息到队列后发现队列上没有消费者,则会把消息返还给发送者,在 RabbitMQ 3.0以后的版本里,去掉了immediate参数的支持

msg - 消息内容

func (*Channel) PublishWithContext

func (this *Channel) PublishWithContext(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing) error

func (*Channel) PublishWithDeferredConfirm

func (this *Channel) PublishWithDeferredConfirm(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)

func (*Channel) PublishWithDeferredConfirmWithContext

func (this *Channel) PublishWithDeferredConfirmWithContext(ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)

func (*Channel) Qos

func (this *Channel) Qos(prefetchCount int, prefetchSize int, global bool) error

func (*Channel) QueueBind

func (this *Channel) QueueBind(name string, key string, exchange string, noWait bool, args amqp.Table) error

func (*Channel) QueueDeclare

func (this *Channel) QueueDeclare(name string, durable bool, autoDelete bool, exclusive bool, noWait bool, args amqp.Table) (amqp.Queue, error)

QueueDeclare

name - 队列名称

durable - 是否持久化

autoDelete - 是否自动删除

exclusive - 是否独占

noWait - 是否阻塞

args - 其它参数

func (*Channel) QueueDeclarePassive

func (this *Channel) QueueDeclarePassive(name string, durable bool, autoDelete bool, exclusive bool, noWait bool, args amqp.Table) (amqp.Queue, error)

func (*Channel) QueueDelete

func (this *Channel) QueueDelete(name string, ifUnused, ifEmpty, noWait bool) (int, error)

func (*Channel) QueuePurge

func (this *Channel) QueuePurge(name string, noWait bool) (int, error)

func (*Channel) QueueUnbind

func (this *Channel) QueueUnbind(name, key, exchange string, args amqp.Table) error

func (*Channel) Reject

func (this *Channel) Reject(tag uint64, requeue bool) error

func (*Channel) Tx

func (this *Channel) Tx() error

func (*Channel) TxCommit

func (this *Channel) TxCommit() error

func (*Channel) TxRollback

func (this *Channel) TxRollback() error

type Config

type Config struct {
	amqp.Config
	ReconnectInterval time.Duration
}

type Connection

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

func NewConn

func NewConn(url string, config Config) (*Connection, error)

func (*Connection) Channel

func (this *Connection) Channel() (*Channel, error)

func (*Connection) Close

func (this *Connection) Close() error

func (*Connection) ConnectionState

func (this *Connection) ConnectionState() tls.ConnectionState

func (*Connection) IsClosed

func (this *Connection) IsClosed() bool

func (*Connection) LocalAddr

func (this *Connection) LocalAddr() net.Addr

func (*Connection) OnClose

func (this *Connection) OnClose(handler func(err *amqp.Error))

func (*Connection) OnReconnect

func (this *Connection) OnReconnect(handler func(conn *Connection))

func (*Connection) RemoteAddr

func (this *Connection) RemoteAddr() net.Addr

func (*Connection) UpdateSecret

func (this *Connection) UpdateSecret(newSecret, reason string) error

Directories

Path Synopsis
examples module

Jump to

Keyboard shortcuts

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