punter

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2015 License: MIT Imports: 3 Imported by: 0

README

punter GoDoc

This library provides a "batteries included" consumer for AMQP topics. The aim is to make it as simple as possible to build small AMQP driven consumers.

Sponsor

This project was made possible by Ninja Blocks.

License

This code is Copyright (c) 2014 Mark Wolfe and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

Documentation

Index

Constants

View Source
const Version = "1.2.1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AmqpURI      string
	Exchange     string
	ExchangeType string
	QueueName    string
	Key          string
	MessageTTL   int32 // How long to retain messages in the queue
	Durable      bool  // Queue durable?
	Prefetch     int
}

Config is the settings for the consumer

type Consumer

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

Consumer holds state for the AMQP consumer

func NewConsumer

func NewConsumer(config *Config, ctag string, msgHandler MsgHander) (*Consumer, error)

NewConsumer create and configure a new consumer, this also triggers a connection to AMQP server

func (*Consumer) Shutdown

func (c *Consumer) Shutdown() error

Shutdown enables cleanup of AMQP connection

type ConsumerPool added in v1.2.1

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

ConsumerPool container for consumers

func NewConsumerPool added in v1.2.1

func NewConsumerPool(numWorkers int, consumerNamePrefix string, punterConfig *Config, msgHandler MsgHander) (*ConsumerPool, error)

NewConsumerPool create a pool of consumers for a given configuration.

func (*ConsumerPool) Shutdown added in v1.2.1

func (pool *ConsumerPool) Shutdown()

Shutdown closes all the consumers in the pool.

type MsgHander

type MsgHander func(deliveries <-chan amqp.Delivery, done chan error)

MsgHander function which is supplied to handle delivers.

Jump to

Keyboard shortcuts

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