rabbitmq

package
v0.0.0-...-2e7948a Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessage

func NewMessage(msgType string, data any) ([]byte, error)

Types

type Handler

type Handler func(ctx context.Context, data []byte) error

type Message

type Message struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
}

func ParseMessage

func ParseMessage(body []byte) (*Message, error)

type Option

type Option func(*Server)

func Exchange

func Exchange(name string) Option

func RetryAttempts

func RetryAttempts(attempts int) Option

type Publisher

type Publisher interface {
	Publish(msgType string, data any) error
}

type RabbitMQPublisher

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

func NewRabbitMQPublisher

func NewRabbitMQPublisher(url, exchange string) (*RabbitMQPublisher, error)

func (*RabbitMQPublisher) Close

func (p *RabbitMQPublisher) Close() error

func (*RabbitMQPublisher) Publish

func (p *RabbitMQPublisher) Publish(msgType string, data any) error

type Server

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

func New

func New(l logger.Interface, url string, opts ...Option) *Server

New creates new Server instance.

func (*Server) Notify

func (s *Server) Notify() <-chan error

func (*Server) RegisterConsumer

func (s *Server) RegisterConsumer(queue string, workers int, router map[string]Handler)

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start()

Jump to

Keyboard shortcuts

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