eevy

command module
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: 11 Imported by: 0

README

Description

eevy is a micro weight go based message broker.

Sources listen on http ports, AWS SQS queues etc for incoming events. Event listeners keep an eye out for events with specific names and invoke handlers when certain events are detected.

Handlers can invoke an AWS Lambda function, place the event data on an AWS SQS queue, call an http end point with OAuth2 authentication etc.

Getting started

Installing

From Source

Eevy is built using go so ensure that you have this properly installed first.

go get github.com/hevnly/eevy
go build github.com/hevnly/eevy
Using binary

Download the binary file from the github release page(currently built using Ubuntu system)

Configuration

A yaml file is used to configure the sources, handlers and listeners. It must be called "conf.yml" and sit beside the eevy binary file. Below is an example configuration file;

logs:
  event: stdout
  handler: stderr
  app: /var/log/eevy/app.log
  level: ERROR
sources:
  - type: sqs
    url: https://sqs.eu-west-1.amazonaws.com/999999999/lambda
    region: eu-west-1
  - type: http
    port: 8000
handlers:
  testSqs:
    type: sqs
    region: eu-west-1
    url: https://sqs.eu-west-1.amazonaws.com/999999999999/output
  testLambda:
    type: lambda
    region: eu-west-1
    function: test
  testSqs2:
    type: sqs
    region: eu-west-1
    url: https://sqs.eu-west-1.amazonaws.com/999999999999/output
listeners:
  "_":
    - testSqs
  application.*:
    - testLambda
  test.event2:
    - testSqs2

The above example creates two sources; an AWS SQS and starts listening on port 8000 for HTTP requests. There are three handlers defined which can be used throughout eevy. The "_" listener is a wild card and responds to every event received (this would make more sense if it was "*" however yaml doesn't like special characters at start of a key). It evokes the handlers that are defined it its array, in this example it places the events message received onto an AWS SQS queue via he "testSqs" handler. "application." invokes its handler when any event that begins with "application" is detected. Finally "test.event2" will only be called when exactly that event is revived. Without the trialling "" it will not respond to any event that has a sub event name eg "test.event2.anything".

Logging

Setting the logging level must be oe of the following string values;

  • CRITICAL
  • ERROR
  • WARNING
  • NOTICE
  • INFO
  • DEBUG

Sources

AWS SQS
Description

This listener pulls events from the specified AWS SQS queue.

Config
Name Type Description
type string This must be set to "sqs"
url string The URL for the SQS
region string The aws region it belongs to eg "eu-west-1"
HTTP
Description

This source listens on a specified port for HTTP connections. A POST request should be sent to "http://hostname:/event/". The body of the post request is treated as the message.

Config
Name Type Description
type string This must be set to "http"
port int The port number to listen on
bindIp string Ip address to bind to

Handlers

AWS SQS
Description

When a relevant event is received place its message section onto the supplied AWS SQS.

Config
Name Type Description
type string This must be set to "sqs"
url string The URL for the SQS
region string The aws region it belongs to eg "eu-west-1"
message string The body of the request sent to the listener
AWS Lambda
Description

This listener invokes an AWS Lambda function

Config
Name Type Description
type string This must be set to "lambda"
function string The name of the function to be invoked
region string The AWS region it belongs to eg "eu-west-1"
message string The body of the request sent to the listener
cli
Description

This listener performs a local system call

Config
Name Type Description
type string This must be set to "lambda"
bin string Binary to be called
args []string Arguments to be passed in
timeout int Number of seconds for timeout (0 for none)
message string The body of the request sent to the listener
OAuth2
Description

Use this listener when sending events to an OAuth 2 end point such as the hevnly api.

Config
Name Type Description
type string This must be set to "oauth2"
clientId string OAuth2 client id to use during authentication
clientSecret string The AWS region it belongs to eg "eu-west-1"
scope []string Array of scopes to use during authentication
tokenUrl string OAuth2 token URL
endPoint string URL to call after OAuth2 authentication
verb string ("get" or "post") HTTP verb used when calling endpoint
message string The body of the request sent to the listener
Beanstalkd
Description

Places events into a beanstalkd tube.

Config
Name Type Description
type string This must be set to "beanstalkd"
host string The name of the beanstalkd hostname
port uint Which port number is beanstalkd listening on
tube string Which tube to put event into
message string The body of the request sent to the listener
Variables

Sometimes the end point of an OAuth call we want a handler to call is embedded in the event message. To allow this we can use variables. Variables are handler values that are surrounded by "${message.name}". The following example shows how this should be used; Event

{
    "event":"api.testSqs",
    "message":{"verb":"post","body":"test","url":"http:\/\/hevnly.dev\/img\/r55435730c954c\/resized\"}
}

Handler configuration

- type: oauth2
  clientId: testClientID
  clientSecret: testClientSecret
  scope:
    - oauth2
  tokenUrl: http://test.dev/oauth/v2/token
  endPoint: ${message.url}
  body: ${message.body}
  verb: ${message.verb}

These variables can be used in most handler configuration fields.

Events

An event is simply a json object that must have the following structure

{
    "event": "event.name",
    "message": {"desc": "json object with the associated events data"} 
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/awslabs/aws-sdk-go/aws
Package aws provides core functionality for making requests to AWS services.
Package aws provides core functionality for making requests to AWS services.
_workspace/src/github.com/awslabs/aws-sdk-go/aws/awserr
Package of API error interface accessors for the SDK.
Package of API error interface accessors for the SDK.
_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
Package of API error types.
_workspace/src/github.com/awslabs/aws-sdk-go/service/lambda
Package lambda provides a client for AWS Lambda.
Package lambda provides a client for AWS Lambda.
_workspace/src/github.com/awslabs/aws-sdk-go/service/lambda/lambdaiface
Package lambdaiface provides an interface that satisfies the lambda service.
Package lambdaiface provides an interface that satisfies the lambda service.
_workspace/src/github.com/awslabs/aws-sdk-go/service/sqs
Package sqs provides a client for Amazon Simple Queue Service.
Package sqs provides a client for Amazon Simple Queue Service.
_workspace/src/github.com/awslabs/aws-sdk-go/service/sqs/sqsiface
Package sqsiface provides an interface that satisfies the sqs service.
Package sqsiface provides an interface that satisfies the sqs service.
_workspace/src/github.com/codegangsta/inject
Package inject provides utilities for mapping and injecting dependencies in various ways.
Package inject provides utilities for mapping and injecting dependencies in various ways.
_workspace/src/github.com/go-martini/martini
Package martini is a powerful package for quickly writing modular web applications/services in Golang.
Package martini is a powerful package for quickly writing modular web applications/services in Golang.
_workspace/src/github.com/kr/beanstalk
Package beanstalk provides a client for the beanstalk protocol.
Package beanstalk provides a client for the beanstalk protocol.
_workspace/src/github.com/op/go-logging
Package logging implements a logging infrastructure for Go.
Package logging implements a logging infrastructure for Go.
_workspace/src/github.com/stretchr/objx
objx - Go package for dealing with maps, slices, JSON and other data.
objx - Go package for dealing with maps, slices, JSON and other data.
_workspace/src/github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
_workspace/src/github.com/stretchr/testify/mock
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
_workspace/src/github.com/vaughan0/go-ini
Package ini provides functions for parsing INI configuration files.
Package ini provides functions for parsing INI configuration files.
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
_workspace/src/golang.org/x/oauth2
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
_workspace/src/golang.org/x/oauth2/clientcredentials
Package clientcredentials implements the OAuth2.0 "client credentials" token flow, also known as the "two-legged OAuth 2.0".
Package clientcredentials implements the OAuth2.0 "client credentials" token flow, also known as the "two-legged OAuth 2.0".
_workspace/src/golang.org/x/oauth2/facebook
Package facebook provides constants for using OAuth2 to access Facebook.
Package facebook provides constants for using OAuth2 to access Facebook.
_workspace/src/golang.org/x/oauth2/github
Package github provides constants for using OAuth2 to access Github.
Package github provides constants for using OAuth2 to access Github.
_workspace/src/golang.org/x/oauth2/google
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
_workspace/src/golang.org/x/oauth2/internal
Package internal contains support packages for oauth2 package.
Package internal contains support packages for oauth2 package.
_workspace/src/golang.org/x/oauth2/jws
Package jws provides encoding and decoding utilities for signed JWS messages.
Package jws provides encoding and decoding utilities for signed JWS messages.
_workspace/src/golang.org/x/oauth2/jwt
Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly known as "two-legged OAuth 2.0".
Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly known as "two-legged OAuth 2.0".
_workspace/src/golang.org/x/oauth2/linkedin
Package linkedin provides constants for using OAuth2 to access LinkedIn.
Package linkedin provides constants for using OAuth2 to access LinkedIn.
_workspace/src/golang.org/x/oauth2/odnoklassniki
Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki.
Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki.
_workspace/src/golang.org/x/oauth2/paypal
Package paypal provides constants for using OAuth2 to access PayPal.
Package paypal provides constants for using OAuth2 to access PayPal.
_workspace/src/golang.org/x/oauth2/vk
Package vk provides constants for using OAuth2 to access VK.com.
Package vk provides constants for using OAuth2 to access VK.com.
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
Various stucts that are used to configure sources and handlers.
Various stucts that are used to configure sources and handlers.
Events are created by sources when the system they are listening on trigger an event.
Events are created by sources when the system they are listening on trigger an event.
handler describes all of the systems that events can be sent to by eevy
handler describes all of the systems that events can be sent to by eevy
Listens on sources and envokes handlers when relavent events are detected
Listens on sources and envokes handlers when relavent events are detected
Sources are are where events are placed or called from.
Sources are are where events are placed or called from.

Jump to

Keyboard shortcuts

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