source

package
v0.0.0-...-a74b2ab Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2015 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Sources are are where events are placed or called from. They can listen on a specific http port, watch an AWS SQS queue etc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSources

func StartSources(sourceConf *[]config.Source, rootList *listener.Listener, log logger.Logger, wg sync.WaitGroup)

Pass in the source configuration and this function both builds and starts listening to the source

Types

type Base

type Base struct {
	config.Source

	Listener *listener.Listener

	Log logger.Logger
	// contains filtered or unexported fields
}

Helper struct that performs common functions that most if not all Sources will use

type Beanstalkd

type Beanstalkd struct {
	Base
}

Listens to an AWS SQS. When a message is placed onto this queue it is converted into a Event and assessed by the listeners. The message must be a JSON string representing an Event

func (*Beanstalkd) Listen

func (this *Beanstalkd) Listen(wg sync.WaitGroup)

Satisfies the Source interface. Begins listening to an AWS SQS queue. If no message is on the queue it sleeps for a set period of time before trying again

type Http

type Http struct {
	Base
}

Http source listens to a specified http port. To create an event send a "POST" request to "/event/" with the json event object as the body of the request.

curl -X POST -d '{"event":"test","message":{"test": 1}' http://localhost:8080/event/

func (*Http) Listen

func (s *Http) Listen(wg sync.WaitGroup)

Satisfies the Source interface and starts listening to the specified port

type Source

type Source interface {
	Listen(wg sync.WaitGroup)
	// contains filtered or unexported methods
}

Interface that all sources should satisfy

func BuildFromConfig

func BuildFromConfig(conf config.Source, rootList *listener.Listener, log logger.Logger) Source

Recieve a configuration struct and create the relevant source

type Sqs

type Sqs struct {
	Base
	// contains filtered or unexported fields
}

Listens to an AWS SQS. When a message is placed onto this queue it is converted into a Event and assessed by the listeners. The message must be a JSON string representing an Event

func (*Sqs) Listen

func (s *Sqs) Listen(wg sync.WaitGroup)

Satisfies the Source interface. Begins listening to an AWS SQS queue. If no message is on the queue it sleeps for a set period of time before trying again

Jump to

Keyboard shortcuts

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