couchbase/sync_gateway — pull request #516 by tleyden (2014-12-05 00:04:38+00:00)
Title: Add webhook support

Initial support for webhooks. Implementation is built to support additional events and event handlers in future. Currently only one event is being raised - a DocumentCommitEvent, after a doc is successfully updated in updateDoc.

EventManager maintains a channel (eventChannel) for raised events. The only synchronous activity on the main document update go routine is to add the event to the EventManager channel.

EventManager has a go routine that works the eventChannel. For each event, it passes the event to each registered eventHandler. Each eventHandler creates a go routine for their own processing (for webhook, it's making an HTTP POST).

eventHandlers are defined in config. Currently the only supported eventHandler type is webhook.