Documentation ¶
Index ¶
- func Close()
- func Consume(ctx context.Context, name string, handler Handler, ...) error
- func GetConfig() map[string]*Config
- func Load()
- func Publish(ctx context.Context, name string, data []byte, opts ...options.PublishOption) error
- func PublishWithDelay(ctx context.Context, name string, data []byte, delayTime int, ...) error
- type Action
- type Channel
- func (c *Channel) Close() error
- func (c *Channel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, ...) (<-chan amqp091.Delivery, error)
- func (c *Channel) IsClosed() bool
- func (c *Channel) IsConnected() bool
- func (c *Channel) Publish(ctx context.Context, exchange, key string, mandatory, immediate bool, ...) error
- func (c *Channel) Qos(prefetchCount, prefetchSize int, global bool) error
- type Config
- type Connection
- type Consumer
- type Handler
- type Manager
- type Producer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Consume ¶ added in v1.8.0
func Consume(ctx context.Context, name string, handler Handler, opts ...options.ConsumerOption) error
Consume data from queue
func PublishWithDelay ¶ added in v1.8.0
func PublishWithDelay(ctx context.Context, name string, data []byte, delayTime int, opts ...options.PublishOption) error
PublishWithDelay add a delay msg to queue delayTime: seconds
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel data channel
func NewChannel ¶
NewChannel instance a channel
func (*Channel) Consume ¶ added in v1.8.0
func (c *Channel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp091.Table) (<-chan amqp091.Delivery, error)
Consume consume message
func (*Channel) IsConnected ¶ added in v1.8.0
IsConnected check channel is connected
type Config ¶ added in v1.8.0
type Config struct { URI string `yaml:"uri"` AutoDeclare bool `yaml:"auto-declare"` Timeout time.Duration `yaml:"timeout"` Connection *options.ConnectionOptions `yaml:"connection"` Exchange *options.ExchangeOptions `yaml:"exchange"` Queue *options.QueueOptions `yaml:"queue"` Bind *options.BindOptions `yaml:"bind"` }
type Connection ¶ added in v1.8.0
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶ added in v1.8.0
func NewConnection(opts *options.ConnectionOptions, logger log.Logger) (*Connection, error)
func (*Connection) Close ¶ added in v1.8.0
func (c *Connection) Close() error
func (*Connection) Conn ¶ added in v1.8.0
func (c *Connection) Conn() *amqp091.Connection
func (*Connection) IsClosed ¶ added in v1.8.0
func (c *Connection) IsClosed() bool
func (*Connection) IsConnected ¶ added in v1.8.0
func (c *Connection) IsConnected() bool
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer define consumer for rabbitmq
func NewConsumer ¶
NewConsumer instance a consumer
type Manager ¶ added in v1.8.0
type Manager struct {
// contains filtered or unexported fields
}
var (
DefaultManager *Manager
)
func NewManager ¶ added in v1.8.0
func (*Manager) GetConsumer ¶ added in v1.8.0
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
Producer define struct for producer
func NewProducer ¶
NewProducer create a producer
Source Files ¶
Click to show internal directories.
Click to hide internal directories.