gorabbit

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

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

Go to latest
Published: Jun 25, 2019 License: GPL-3.0 Imports: 1 Imported by: 0

README

gorabbit

Go Rabbit ! is a simple wrapper around streadway/amqp package

To avoid code duplication from one projet to another I needed a simple wrapper around amqp package for Golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer func(Message)

Consumer is a function that takes a amqp.Delivery struct as parameter

type Message

type Message = amqp.Delivery

Message is an alias to amqp.delivery

type MessageBroker

type MessageBroker struct {
	*amqp.Channel
	// contains filtered or unexported fields
}

MessageBroker holds RabbitMQ connections.

func NewMessageBroker

func NewMessageBroker(amqpURL, queue string) (*MessageBroker, error)

NewMessageBroker tries to instantiate a new MessageBroker. This MessageBroker can consume messages from or send messages to a queue.

func (*MessageBroker) Close

func (mb *MessageBroker) Close()

Close closes all open connections

func (*MessageBroker) Listen

func (mb *MessageBroker) Listen(consumer Consumer) error

Listen permits to consume messages from the declared queue. The message has to be acknowledged

Jump to

Keyboard shortcuts

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