Event Hooks: Difference between revisions
Created page with "Event hooks allow you to extend Obsidian's event notifications to support things like instant messaging, customized logging, etc. This feature was introduced in version 4.5.0...." |
No edit summary |
||
| Line 1: | Line 1: | ||
Event hooks allow you to extend Obsidian's event notifications to support things like instant messaging, customized logging, etc. This feature was introduced in version 4.5.0. | Event hooks allow you to extend Obsidian's event notifications to support things like instant messaging, customized logging, etc. This feature was introduced in version 4.5.0. | ||
= EventHook Interface = | = EventHook Interface = | ||
Revision as of 17:31, 28 February 2018
Event hooks allow you to extend Obsidian's event notifications to support things like instant messaging, customized logging, etc. This feature was introduced in version 4.5.0.
EventHook Interface
[http://obsidiansc heduler.com/obsidianapi/com/carfey/ops/event/dispatch/EventHook.html EventHook Javadoc]
Note: If you need to set up a development environment to create Obsidian event hooks, see the Classpath section.
Implementing custom notifications in Obsidian is as simple as implementing a single interface and calling a method to register it with the scheduler.
The interface you need to implement is the following.
public interface EventHook {
public abstract void dispatch(Event event) throws Exception;
}
After creating an instance of a class that implements EventHook, you simply need to register it with Obsidian. The example below shows our reference implementation which posts notifications to a Slack channel by using incoming web hooks.
EventHook customNotifier = new SlackEventHook("Obsidian Scheduler", "https://hooks.slack.com/services/XXXXXXX/YYYYYYYY/ZZZZZZZZZZ", SlackEventHook.DEFAULT_LEVELS, SlackEventHook.Default_CATEGORIES);
eventHooks.register(customNotifier);