worker

package
v0.0.0-...-5ee6e8d Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2012 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

A convenient way to run jobs from beanstalkd.

This package is still in flux.

import "beanstalk/worker"
worker.Handle("resize", my_resizer)
worker.Handle("sync", my_syncer)
worker.DialAndWork("localhost:11300", nil)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialAndWork

func DialAndWork(addr string, w Worker) os.Error

Open a connection to beanstalkd and run jobs. If w is nil, use DefaultTubeMux.

func Handle

func Handle(tubeName string, r Runner)

Install a runner in DefaultTubeMux.

Types

type Reserver

type Reserver interface {
	Reserve() (beanstalk.Job, os.Error)
}

type Runner

type Runner interface {
	Run(beanstalk.Job)
}

type TubeMux

type TubeMux struct {
	DefaultRunner Runner
	// contains filtered or unexported fields
}

func (*TubeMux) Handle

func (w *TubeMux) Handle(tubeName string, r Runner)

func (*TubeMux) Work

func (w *TubeMux) Work(r Reserver) os.Error

type Worker

type Worker interface {
	Work(Reserver)
	TubeNames() []string
}

Jump to

Keyboard shortcuts

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