mq

package
v0.0.0-...-d4285bb Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_AMQP_URI                = "amqp://guest:guest@localhost:5672/"
	LOG_AMQPWORKER                  = "processing/amqp_worker.go"
	WORKER_QUEUE                    = "worker_queue"
	SUB_START, SUB_END, SUB_REDO    = "submission_start", "submission_end", "submission_redo"
	FILE, STATUS                    = "file", "status"
	SUCCESS, IDLE                   = "success", "wait_idle"
	ERR_ID, ERR_REQUEST, ERR_STATUS = "error_id", "error_request", "error_status"
	PREFETCH_COUNT                  = 3
	PREFETCH_SIZE                   = 0
	DIRECT                          = "direct"
	FANOUT                          = "fanout"
)
View Source
const (
	TASK_QUEUE = "task_queue"
)

Variables

This section is empty.

Functions

func AddFile

func AddFile(f *project.File, k string) error

AddFile

func ChangeStatus

func ChangeStatus(r *request.R) error

ChangeStatus is used to update Impendulo's current processing status.

func EndSubmission

func EndSubmission(id bson.ObjectId, k string) error

EndSubmission sends a message on AMQP that this submission has been completed by the user and can thus be closed when processing is done.

func GetStatus

func GetStatus() (*status.S, error)

GetStatus retrieves the current status of impendulo's processors

func H

func H(m *MessageHandler)

func NewSubmitter

func NewSubmitter(rc chan *request.R) (*MessageHandler, *MessageHandler, error)

func RedoSubmission

func RedoSubmission(id bson.ObjectId) error

RedoSubmission

func Reply

func Reply(c *amqp.Channel, d amqp.Delivery, b []byte) error

func SetAMQP_URI

func SetAMQP_URI(uri string)

func StartSubmission

func StartSubmission(id bson.ObjectId) (string, error)

StartSubmission

func StopProducers

func StopProducers() error

StopProducers shuts all active producers down.

func WaitIdle

func WaitIdle() error

WaitIdle will only return once impendulo's processors are idle when called.

Types

type Changer

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

Changer is a Consumer which listens for updates to Impendulo's status and changes it accordingly.

func (*Changer) Consume

func (c *Changer) Consume(d amqp.Delivery, ch *amqp.Channel) (e error)

type Consumer

type Consumer interface {
	Consume(amqp.Delivery, *amqp.Channel) error
}

Consumer is an interface for allowing the processing of messages from AMQP.

type Loader

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

Loader is a Consumer which listens for status requests on AMQP and responds to them with Impendulo's current status.

func (*Loader) Consume

func (l *Loader) Consume(d amqp.Delivery, ch *amqp.Channel) (e error)

type MessageHandler

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

MessageHandler wraps a consumer in a struct in order to provide with other tools to manage its AMQP connection.

func NewChanger

func NewChanger(c chan *request.R) (*MessageHandler, error)

func NewHandler

func NewHandler(amqpURI, exchange, exchangeType, queue, ctag string, consumer Consumer, keys ...string) (*MessageHandler, error)

NewHandler

func NewLoader

func NewLoader(c chan status.S) (*MessageHandler, error)

func NewRedoer

func NewRedoer(rc chan *request.R) (*MessageHandler, error)

func NewWaiter

func NewWaiter(c chan util.E) (*MessageHandler, error)

func (*MessageHandler) Handle

func (m *MessageHandler) Handle() error

func (*MessageHandler) Shutdown

func (m *MessageHandler) Shutdown() error

type NewRequestHandler

type NewRequestHandler func(amqpURI string, requestChan chan *request.R) (*MessageHandler, error)

type NewStatusHandler

type NewStatusHandler func(amqpURI string, statusChan chan status.S) (*MessageHandler, error)

type Producer

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

Producer is used to create new tasks which it publishes to the queue.

func FileProducer

func FileProducer(amqpURI string, fileKey string) (*Producer, error)

FileProducer

func NewProducer

func NewProducer(name, amqpURI, exchange, exchangeType, publishKey string) (*Producer, error)

NewProducer

func RedoProducer

func RedoProducer(amqpURI string) (*Producer, error)

RedoProducer

func StatusChanger

func StatusChanger(amqpURI string) (*Producer, error)

StatusChanger creates a Producer which can update Impendulo's status.

func (*Producer) Produce

func (p *Producer) Produce(d []byte) error

Produce publishes the provided data on the amqp.Channel as configured previously.

func (*Producer) Shutdown

func (p *Producer) Shutdown() error

Shutdown stops this Producer by closing its channel and connection.

type ReceiveProducer

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

ReceiveProducer is used to create new tasks which it publishes to the queue. It also receives a response from the consumer which received its task.

func IdleWaiter

func IdleWaiter(amqpURI string) (*ReceiveProducer, error)

IdleWaiter

func NewReceiveProducer

func NewReceiveProducer(name, amqpURI, exchange, exchangeType, publishKey, bindingKey, ctag string) (*ReceiveProducer, error)

NewReceiveProducer

func StartProducer

func StartProducer(amqpURI string) (*ReceiveProducer, error)

StartProducer creates a new Producer which is used to signal the start or end of a submission.

func StatusRetriever

func StatusRetriever(amqpURI string) (*ReceiveProducer, error)

StatusRetriever

func (*ReceiveProducer) ReceiveProduce

func (r *ReceiveProducer) ReceiveProduce(d []byte) ([]byte, error)

ReceiveProduce

type Redoer

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

Redoer is a Consumer which listens for requests to reanalyse submissions and submits them for reanalysis.

func (*Redoer) Consume

func (r *Redoer) Consume(d amqp.Delivery, ch *amqp.Channel) (e error)

type Starter

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

Starter is a Consumer used to connect a Submitter to a submission request.

func (*Starter) Consume

func (s *Starter) Consume(d amqp.Delivery, ch *amqp.Channel) error

type Submitter

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

Submitter is a Consumer used to handle submission and file requests.

func (*Submitter) Consume

func (s *Submitter) Consume(d amqp.Delivery, ch *amqp.Channel) (e error)

type Waiter

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

Waiter is a Consumer which listens for requests for when Impendulo is idle and responds to them when it is.

func (*Waiter) Consume

func (w *Waiter) Consume(d amqp.Delivery, ch *amqp.Channel) (e error)

Jump to

Keyboard shortcuts

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