messages

package module
Version: v0.0.0-...-2e02ff3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

README

messages

Provides a tiny convenience wrapper on top of the streadway's AMQP library for event publish/subscribe for Go

This is heavily based on the AMQP library publish/subscribe example for Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(exchange string, sessions chan chan AmqpSession, messages <-chan AmqpMessage)

Publish deals with setting up a process to handle publishing messages to an exchange.

func Redial

func Redial(ctx context.Context, exchange string, url string) chan chan AmqpSession

Redial continuously connects to the message broker exiting when it can no longer make the connection.

func Subscribe

func Subscribe(exchange string, sessions chan chan AmqpSession, messages chan<- AmqpMessage)

Subscribe deals with setting up a new listener to events published to a certain exchange.

Types

type AmqpMessage

type AmqpMessage struct {
	Headers     amqp.Table
	Body        []byte
	ContentType string
}

AmqpMessage with headers and content type to work as an intermediary for application specific data structures.

type AmqpSession

type AmqpSession struct {
	*amqp.Connection
	*amqp.Channel
}

AmqpSession provides a composition of a connection and channel to be used in the self-reconnecting AMQP client.

func (AmqpSession) Close

func (s AmqpSession) Close() error

Close deals with closing the connection of the provided session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL