queue

package
v0.0.0-...-4eaaba6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package queue implements a Pub/Sub channel in tsuru. It abstracts which server is being used and handles connection pooling and data transmiting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, factory QFactory)

Register registers a new queue factory. This is how one would add a new queue to tsuru.

Types

type PubSubQ

type PubSubQ interface {
	// Publishes a message using the underlaying queue server.
	Pub(msg []byte) error

	// Returns a channel that will yield every message published to this
	// queue.
	Sub() (chan []byte, error)

	// Unsubscribe the queue, this should make sure the channel returned
	// by Sub() is closed.
	UnSub() error
}

PubSubQ represents an implementation that allows Publishing and Subscribing messages.

type QFactory

type QFactory interface {
	// Get returns a queue instance, identified by the given name.
	Get(name string) (PubSubQ, error)
}

QFactory manages queues. It's able to create new queue and handler instances.

func Factory

func Factory() (QFactory, error)

Factory returns an instance of the QFactory used in tsuru. It reads tsuru configuration to find the currently used queue system and returns an instance of the configured system, if it's registered. Otherwise it will return an error.

Jump to

Keyboard shortcuts

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