rabbitmq

package
v0.0.0-...-5176009 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MIT Imports: 5 Imported by: 0

README

RabbitMQ Helper

This was a simple test to see if I could write a RabbitMQ consumer and producer.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Username string
	Password string
	Hostname string
	Port     int
}

func NewConfig

func NewConfig() *Config

func (*Config) GetConnectionString

func (c *Config) GetConnectionString() string

type Consumer

type Consumer struct {
	Name     string
	Exchange Exchange

	DoneChan chan error
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer(consumerName string, queueName string, exchange Exchange, config *Config) (consumer *Consumer, err error)

func (*Consumer) AddHandler

func (c *Consumer) AddHandler(handler Handler)

func (*Consumer) Close

func (c *Consumer) Close() error

type Exchange

type Exchange struct {
	Name       string
	Type       string
	RoutingKey string
}

func (*Exchange) Validate

func (ex *Exchange) Validate() error

type Handler

type Handler interface {
	HandleMessage(message *amqp.Delivery) error
}

type HandlerFunc

type HandlerFunc func(message *amqp.Delivery) error

func (HandlerFunc) HandleMessage

func (h HandlerFunc) HandleMessage(m *amqp.Delivery) error

type Producer

type Producer struct {
	Exchange Exchange
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(exchange Exchange, config *Config) (producer *Producer, err error)

func (*Producer) SendMessage

func (p *Producer) SendMessage(mess []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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