rmq

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalMessage

func UnmarshalMessage(data []byte, v any) error

Types

type Client

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

func NewClient

func NewClient(log *logger.Logger, cfg *Config) (*Client, error)

func (*Client) Channel

func (c *Client) Channel() *amqp091.Channel

func (*Client) Close

func (c *Client) Close() error

func (*Client) Reconnect

func (c *Client) Reconnect() error

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
}

func (*Config) URL

func (c *Config) URL() string

type Consumer

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

func NewConsumer

func NewConsumer(log *logger.Logger, client *Client, cfg *ConsumerConfig) (*Consumer, error)

func (*Consumer) Start

func (c *Consumer) Start(ctx context.Context) error

func (*Consumer) Stop

func (c *Consumer) Stop()

type ConsumerConfig

type ConsumerConfig struct {
	Main    QueueConfig
	Delay   *DelayQueueConfig
	Dead    *QueueConfig
	Handler MessageHandler
}

type DelayQueueConfig

type DelayQueueConfig struct {
	QueueConfig
	MaxRetry int
}

type MessageHandler

type MessageHandler func(ctx context.Context, message []byte, routingKey string) error

type QueueConfig

type QueueConfig struct {
	Queue          string
	BindingPattern string
	Exchange       string
	TTL            int
}

Jump to

Keyboard shortcuts

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