schedule

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

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

Go to latest
Published: Nov 15, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskBroker

type TaskBroker struct {
	ConnectionName string
	// contains filtered or unexported fields
}

TaskBroker represents an instance of message broker used in the A01 system

func CreateInClusterTaskBroker

func CreateInClusterTaskBroker() *TaskBroker

CreateInClusterTaskBroker returns a in-cluster task broker instance

func CreateLocalTaskBroker

func CreateLocalTaskBroker() *TaskBroker

CreateLocalTaskBroker returns a TaskBroker instance used in local testing. The instance expects a message broker running at local 5672 port.

func (*TaskBroker) Close

func (broker *TaskBroker) Close()

Close the channel and connection

func (*TaskBroker) GetChannel

func (broker *TaskBroker) GetChannel() (*amqp.Channel, error)

GetChannel returns the channel to this task broker. If a channel hasn't been established, a new channel as well as a connection will be created.

func (*TaskBroker) PublishTasks

func (broker *TaskBroker) PublishTasks(queueName string, settings []models.TaskSetting) (err error)

PublishTasks publishes the tasks to the queue specified by the given name. The queue will be declared if it doesn't already exist.

func (*TaskBroker) QueueDeclare

func (broker *TaskBroker) QueueDeclare(name string) (queue amqp.Queue, ch *amqp.Channel, err error)

QueueDeclare declare a queue associated with the given name. It returns the queue as well as the channel associate with this connection. If a channel has not been established, a new one will be created.

Jump to

Keyboard shortcuts

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