lonelycode/tyk — pull request #15 by lonelycode (2014-10-23 10:04:37+00:00)
Title: Feature/event system

Extensible and modular event subsystem, allows multiple handlers for different event types to be defined in the API Definition, e.g.:

"event_handlers": {
"events": {
"QuotaExceeded": [
{
"handler_name":"eh_log_handler",
"handler_meta": {
"prefix": "LOG-HANDLER-PREFIX"
}
},
{
"handler_name":"eh_log_handler",
"handler_meta": {
"prefix": "ANOTHER-LOG-HANDLER-PREFIX"
}
}
]
}
},

Event types can be created by creating new `TykEvent` types, new handler by implementing `TykEventHandler` interface.

Events are fired as goroutines so should not interrupt request flow. Demo event handler implemented as `LogMessageEventHandler`