rabbitmq

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

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(options ...Option) mq.IBroker

Types

type Broker

type Broker struct {
	amqp.Config

	ilog.ILogger //default logger
	codec.ICodec //default codec
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Broker) Close

func (b *Broker) Close() error

func (*Broker) Connect

func (b *Broker) Connect(url string) (err error)

func (*Broker) OpenChannel

func (b *Broker) OpenChannel(name string) (mq.IChannel, error)

func (*Broker) Publish

func (b *Broker) Publish(topic string, v any) error

func (*Broker) Subscribe

func (b *Broker) Subscribe(topic string, handler mq.MessageHandler) error

type Channel

type Channel struct {
	sync.Map
	sync.Mutex
	// contains filtered or unexported fields
}

channel represents a task

func (*Channel) Close

func (c *Channel) Close() error

func (*Channel) DeclareQueue

func (c *Channel) DeclareQueue(queue string) error

func (*Channel) Delivering

func (c *Channel) Delivering(delivery Delivery)

continuous delivery

func (*Channel) Publish

func (c *Channel) Publish(topic string, v any) error

func (*Channel) Subscribe

func (c *Channel) Subscribe(topic string, handler mq.MessageHandler) error

type Delivery

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

type Option

type Option func(o *Broker)

func MustWithCodec

func MustWithCodec(c codec.ICodec) Option

func MustWithLogger

func MustWithLogger(logger ilog.ILogger) Option

func WithConsumerName

func WithConsumerName(name string) Option

func WithDeclareQueues

func WithDeclareQueues(queues ...string) Option

func WithDefaultExchange

func WithDefaultExchange(exchange string) Option

func WithHeartbeatInterval

func WithHeartbeatInterval(duration time.Duration) Option

less than 1s uses the server's interval

func WithMaxTryReconnectTimes

func WithMaxTryReconnectTimes(times uint32) Option

default 10,0 means no limit,The maximum number of reconnections allowed after disconnection

func WithPanicHandler

func WithPanicHandler(f func(mq.IMessage, error)) Option

func WithReconnectInterval

func WithReconnectInterval(duration time.Duration) Option

default 10s,reconnection interval

func WithVhost

func WithVhost(vhost string) Option

Jump to

Keyboard shortcuts

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