rabbitmq

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

README

rabbitmq

-- import "github.com/peter-mount/golib/rabbitmq"

A simple amqp library for connecting to RabbitMQ

This is a wrapper around the github.com/streadway/amqp library.

Usage

type RabbitMQ
type RabbitMQ struct {
	// The amqp url to connect to
	Url string `yaml:"url"`
	// The schange for publishing, defaults to amq.topic
	Exchange string `yaml:"exchange"`
	// The name of the connection that appears in the management plugin
	ConnectionName string `yaml:"connectionName"`
	// The heartBeat in seconds. Defaults to 10
	HeartBeat int `yaml:"heartBeat"`
	// The product name in the management plugin (optional)
	Product string `yaml:"product"`
	// The product version in the management plugin (optional)
	Version string `yaml:"version"`
}
func (*RabbitMQ) Connect
func (s *RabbitMQ) Connect() error

Connect connects to the RabbitMQ instace thats been configured.

func (*RabbitMQ) Consume
func (r *RabbitMQ) Consume(channel *amqp.Channel, queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)

Consume adds a consumer to the queue and returns a GO channel

func (*RabbitMQ) NewChannel
func (s *RabbitMQ) NewChannel() (*amqp.Channel, error)
func (*RabbitMQ) Publish
func (s *RabbitMQ) Publish(routingKey string, msg []byte) error

Publish a message

func (*RabbitMQ) QueueBind
func (r *RabbitMQ) QueueBind(channel *amqp.Channel, name, key, exchange string, noWait bool, args amqp.Table) error

QueueBind binds a queue to an exchange & routingKey

func (*RabbitMQ) QueueDeclare
func (r *RabbitMQ) QueueDeclare(channel *amqp.Channel, name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error)

QueueDeclare declares a queue

Documentation

Overview

A simple amqp library for connecting to RabbitMQ

This is a wrapper around the github.com/streadway/amqp library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RabbitMQ

type RabbitMQ struct {
	// The amqp url to connect to
	Url string `yaml:"url"`
	// The schange for publishing, defaults to amq.topic
	Exchange string `yaml:"exchange"`
	// The name of the connection that appears in the management plugin
	ConnectionName string `yaml:"connectionName"`
	// The heartBeat in seconds. Defaults to 10
	HeartBeat int `yaml:"heartBeat"`
	// The product name in the management plugin (optional)
	Product string `yaml:"product"`
	// The product version in the management plugin (optional)
	Version string `yaml:"version"`
	// contains filtered or unexported fields
}

func (*RabbitMQ) Connect

func (s *RabbitMQ) Connect() error

Connect connects to the RabbitMQ instace thats been configured.

func (*RabbitMQ) Consume

func (r *RabbitMQ) Consume(channel *amqp.Channel, queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)

Consume adds a consumer to the queue and returns a GO channel

func (*RabbitMQ) NewChannel

func (s *RabbitMQ) NewChannel() (*amqp.Channel, error)

func (*RabbitMQ) Publish

func (s *RabbitMQ) Publish(routingKey string, msg []byte) error

Publish a message

func (*RabbitMQ) QueueBind

func (r *RabbitMQ) QueueBind(channel *amqp.Channel, name, key, exchange string, noWait bool, args amqp.Table) error

QueueBind binds a queue to an exchange & routingKey

func (*RabbitMQ) QueueDeclare

func (r *RabbitMQ) QueueDeclare(channel *amqp.Channel, name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error)

QueueDeclare declares a queue

Jump to

Keyboard shortcuts

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