rabbit

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DelayedMessage   = "x-delayed-message"
	DelayedType      = "x-delayed-type"
	DefaultDelayType = "topic"
)

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(options *Options) (*amqp.Connection, error)

Types

type Binding

type Binding struct {
	Exchange string `yaml:"exchange"`
	Key      string `yaml:"key"`
	Nowait   bool   `yaml:"nowait"`
}

Binding specifies to which exchange should be an exchange or a queue binded

type Client

type Client interface {
	CreateScheme(s *Options) error
	SendMessage(ex, key string, data []byte, headers map[string]interface{}) error
	ProcessQueue(name string, f func(map[string]interface{}, []byte) error) error
}

func NewClient

func NewClient(conn *amqp.Connection, options *Options) (Client, error)

Connect connects to RabbitMQ by dsn and return client object which uses openned client during function calls issued later in code

type Exchange

type Exchange struct {
	Durable    bool      `yaml:"durable"`
	AutoDelete bool      `yaml:"auto-delete"`
	Internal   bool      `yaml:"internal"`
	Nowait     bool      `yaml:"nowait"`
	Type       string    `yaml:"type"`
	Bindings   []Binding `yaml:"bindings"`
	Args       map[string]interface{}
}

Exchange is structure with specification of properties of RabbitMQ exchange

type Options

type Options struct {
	Addresses   string               `yaml:"addresses"`
	Username    string               `yaml:"username"`
	Password    string               `yaml:"password"`
	VirtualHost string               `yaml:"virtual-host"`
	Exchanges   map[string]Exchange  `yaml:"exchanges"`
	Queues      map[string]QueueSpec `yaml:"queues"`
}

Settings is a specification of all queues and exchanges together with all bindings.

func NewOptions

func NewOptions(v *viper.Viper) (*Options, error)

type QueueSpec

type QueueSpec struct {
	Durable    bool      `yaml:"durable"`
	AutoDelete bool      `yaml:"auto-delete"`
	Nowait     bool      `yaml:"nowait"`
	Exclusive  bool      `yaml:"exclusive"`
	Bindings   []Binding `yaml:"bindings"`
}

QueueSpec is a specification of properties of RabbitMQ queue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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