rabbitmq

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: Apache-2.0 Imports: 7 Imported by: 3

README

go-rabbitmq

An slightly opiniated abstraction for using RabbitMQ services from various Cloud environments. Only tested on Cloudfoundry at this time.

usage

TODO

author

Andy Lo-A-Foe andy.loafoe@aemian.com

license

Apache. Also see the NOTICE file.

Documentation

Overview

Copyright 2018 Andy Lo-A-Foe. All rights reserved. Use of this source code is governed by Apache-style license that can be found in the LICENSE file.

Copyright 2018 Andy Lo-A-Foe. All rights reserved. Use of this source code is governed by Apache-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName  string
	Exchange     string
	ExchangeType string
	Durable      bool
	AutoDelete   bool
	QueueName    string
	RoutingKey   string
	CTag         string
	HandlerFunc  ConsumerHandlerFunc
}

type Consumer

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

func NewConsumer

func NewConsumer(config Config) (*Consumer, error)

func (*Consumer) AnnounceQueue

func (c *Consumer) AnnounceQueue(queueName, bindingKey string) (<-chan amqp.Delivery, error)

AnnounceQueue sets the queue that will be listened to for this connection...

func (*Consumer) Connect

func (c *Consumer) Connect() error

Connect to RabbitMQ server

func (*Consumer) Handle

func (c *Consumer) Handle(
	d <-chan amqp.Delivery,
	fn ConsumerHandlerFunc,
	threads int,
	queue string,
	routingKey string)

Handle has all the logic to make sure your program keeps running d should be a delievey channel as created when you call AnnounceQueue fn should be a function that handles the processing of deliveries this should be the last thing called in main as code under it will become unreachable unless put int a goroutine. The q and rk params are redundent but allow you to have multiple queue listeners in main without them you would be tied into only using one queue per connection

func (*Consumer) Start

func (c *Consumer) Start() error

type ConsumerHandlerFunc

type ConsumerHandlerFunc func(deliveries <-chan amqp.Delivery) error

type Producer

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

func NewProducer

func NewProducer(config Config) (*Producer, error)

func (*Producer) Close

func (p *Producer) Close()

func (*Producer) Publish

func (p *Producer) Publish(exchange, routingKey string, msg amqp.Publishing) error

Jump to

Keyboard shortcuts

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