Configure an Event Handler
To configure an event handler, follow these steps.
To configure an event handler
- Stop the connector.
- Open the connector’s configuration file in a text editor.
-
Set the
OnStart,OnFinish,OnError, orOnQueueEventparameter to specify the name of a section in the configuration file that contains the event handler settings.-
To run an event handler for all asynchronous actions, set these parameters in the
[Actions]section. For example:[Actions] OnStart=NormalEvents OnFinish=NormalEvents OnError=ErrorEvents
-
To run an event handler for specific actions, use the action name as a section in the configuration file. The following example calls an event handler when the Fetch action starts and finishes successfully:
[Fetch] OnStart=NormalEvents OnFinish=NormalEvents
-
- Create a new section in the configuration file to contain the settings for your event handler. You must name the section using the name you specified with the
OnStart,OnFinish,OnError, orOnQueueEventparameter. -
In the new section, set the
LibraryNameparameter.LibraryNameThe type of event handler to use to handle the event:
- To write event data to a text file, set this parameter to
TextFileHandler, and then set theFilePathparameter to specify the path of the file. - To send event data to a URL, set this parameter to
HttpHandler, and then use the HTTP event handler parameters to specify the URL, proxy server settings, credentials and so on. - To run a Lua script, set this parameter to
LuaHandler, and then set theLuaScriptparameter to specify the script to run. For information about writing the script, see Write a Lua Script to Handle Events.
For example:
[NormalEvents] LibraryName=TextFileHandler FilePath=./events.txt [ErrorEvents] LibraryName=LuaHandler LuaScript=./error.lua
- To write event data to a text file, set this parameter to
- Save and close the configuration file. You must restart Yammer Connector for your changes to take effect.