rabbit

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

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 5 Imported by: 0

README

Go RabbitMQ client wrapper

Based on Go AMQP client library "github.com/streadway/amqp"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host       string `json:"host"`
	Exchange   string `json:"exchange"`
	BindingKey string `json:"bindingkey"`
	Verbose    bool   `json:"verbose"`
	Timeout    int    `json:"timeout"`
}

Config is configuration structure - Host: IP or hostname to RabbitMQ server - Exchange: exchange to subscribe from - BindingKey: key to select messages - Verbose: log verbose - Timeout: deprecated

type Rabbit

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

Rabbit is a client to RabbitMQ

func NewRabbit

func NewRabbit(conf *Config) *Rabbit

NewRabbit is a default constructor for Rabbit type

func (*Rabbit) AddExtraExchange

func (c *Rabbit) AddExtraExchange(name string)

AddExtraExchange creates new exchange connection

func (*Rabbit) AutoConnect

func (c *Rabbit) AutoConnect(timeout int)

AutoConnect is acync methon to establish aand keep connection

func (*Rabbit) Close

func (c *Rabbit) Close()

Close deletes connection

func (*Rabbit) IsOpen

func (c *Rabbit) IsOpen() bool

IsOpen is a property indicates if connection is open

func (*Rabbit) Push

func (c *Rabbit) Push(key string, message string, exchange string) error

Push publishes key/message to the exchange

func (*Rabbit) Subscribe

func (c *Rabbit) Subscribe(receiver string, handler func(*amqp.Delivery)) error

Subscribe register a callback by receiver's name

func (*Rabbit) SubscribeWithBindings

func (c *Rabbit) SubscribeWithBindings(bindings []string, receiver string, handler func(*amqp.Delivery)) error

Subscribe register a callback by receiver's name

func (*Rabbit) Unsubscribe

func (c *Rabbit) Unsubscribe()

Unsubscribe cancels subscription to default exchange

Jump to

Keyboard shortcuts

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