kuyruk

package module
v0.0.0-...-0b50d32 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2016 License: MIT Imports: 9 Imported by: 0

README

kuyruk-go

Library for sending Kuyruk tasks from Go programs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	RabbitURI:                   "amqp://guest:guest@localhost:5672/",
	RabbitConnectionWaitTimeout: 30 * time.Second,
}

DefaultConfig is a Config with default values set. You should not modify this. Instead copy and modify that.

Functions

This section is empty.

Types

type Config

type Config struct {
	RabbitURI                   string
	RabbitConnectionWaitTimeout time.Duration
}

Config for Kuyruk application.

type Kuyruk

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

Kuyruk is the main type of this library. It holds a single connection to RabbitMQ server.

func New

func New(config Config) (*Kuyruk, error)

New returns a new Kuyruk value, validating the config.

func (*Kuyruk) Run

func (k *Kuyruk) Run()

Run this instance. Call this function with a go statement. It will connect to the RabbitMQ server.

func (*Kuyruk) Task

func (k *Kuyruk) Task(module, function, queue string) *Task

Task creates a definition to run a function on a remote worker.

type Task

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

Task that is going to be run on a Kuyruk worker.

func (*Task) SendToQueue

func (t *Task) SendToQueue(args []interface{}, kwargs map[string]interface{}) error

SendToQueue serializes the task and publishes a message to RabbitMQ server.

func (*Task) SendToQueueHost

func (t *Task) SendToQueueHost(args []interface{}, kwargs map[string]interface{}, hostname string) error

SendToQueueHost works like SendToQueue but allows appending hostname to the queue name.

Jump to

Keyboard shortcuts

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