rque

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2015 License: MIT Imports: 3 Imported by: 0

README

go-rque

Simple queue build with RethinkDB. Requires go-emitter.

View the docs.

Installation

$ go get github.com/frozzare/go-rque

Example

package main

import (
	"fmt"

	"github.com/frozzare/go-emitter"
	"github.com/frozzare/go-rque"
)

func main() {
	e := emitter.New()

	e.On("hello", func(job rque.Job) {
		fmt.Println("hello")
	})

	rque.Run(rque.Config{
		Address:  "localhost:28015",
		Database: "db",
		Table:    "queue",
		Emitter:  e,
	})
}

JSON row in the database:

{
    "name": "hello",
    "data": {}
}

License

MIT © Fredrik Forsmo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(c Config)

Run the worker.

Types

type Config

type Config struct {
	Address  string
	Database string
	Emitter  *emitter.Emitter
	Table    string
}

Config represent the configurations of the queue

type Job

type Job struct {
	ID   string      `gorethink:"id,omitempty" json:"id"`
	Name string      `gorethink:"name" json:"name"`
	Data interface{} `gorethink:"data,omitempty" json:"data"`
}

Job represent a job in the database

Jump to

Keyboard shortcuts

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