rabbit

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

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Fanout ExchangeType = "fanout"
	Direct              = "direct"
	Topic               = "topic"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Listen(ctx context.Context, opt *Options, callback MessageCallback) error
	Publisher(opt *Options) Publisher
}

func NewClient

func NewClient(uri string, logger *slog.Logger) Client

type Encoder

type Encoder interface {
	MimeType() string
	Encode(interface{}) (string, []byte, error)
}

type ExchangeType

type ExchangeType string

type MessageCallback

type MessageCallback func([]byte) error

type Options

type Options struct {
	Type       ExchangeType
	Exchange   string
	Queue      string
	RoutingKey string
	AutoAck    bool
	Durable    bool
}

func (*Options) String

func (opt *Options) String() string

type Publisher

type Publisher interface {
	Publishing(key, mineType string, data []byte) error
	PublishJson(string, interface{}) error
	Publish(encoder Encoder, data interface{}) error
}

Jump to

Keyboard shortcuts

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