EventHandlers
EventHandlers are used to extend the functionality of AssemblyLines and Connectors by providing a framework to control their execution in a bigger
context. This is particularly useful when an incoming event (i.e. incoming
http, LDAP change trigger or JMS message) can trigger a number of different AssemblyLines
depending on some content in the incoming content. A few EventHandlers has been pre-programmed to make things easier. You can
always override behaviour by using your own scripts.
EventHandler Types
There are two types of EventHandlers. The first (originally called a trigger
or port listener)
is an EventHandler that usually resorts to a user defined script to perform
specific actions when the event occurs. With these EventHandlers you have full control but you must code your
actions by hand. The second type is a higher level handler where you specify
conditions and actions using a number of predefined conditions and actions. The
latter is much simpler to use and also provides hooks where you can execute
script code for full control.
For example, there are two versions of the Mailbox EventHandler. The simple
Mailbox EventHandler calls into a script when something happens in the mailbox
providing the script access to the mailbox folder, message and some other
objects. The second Mailbox EventHandler allows you to specify conditions and
choose actions using drop-down tables and forms. The latter is then easier to
configure since you really don't have to write a single line of code to handle
the event.
For simplicity we will refer to the first type as
a simple EventHandler and the second type as (simply) an EventHandler.
When are they started?
When Metamerge server starts it walks through the table of EventHandlers and
checks each one for the auto startup flag. If the auto startup is set the EventHandler
is spawned as a thread inside the Metamerge server process. When the EventHandler
thread terminates, either normally or abnormally, Metamerge server
will not restart the EventHandler. You can force an EventHandler to start
regardless of its auto start flag using command
line options.
(See Starting
the EventHandler for further discussion on how to start Event Handlers from
the Admin Tool)
What do they do?
EventHandlers are expected to perform a variety of functions but typically they will enable external events to trigger actions in
the Metamerge server. These actions could be specific to each site and each
person, but one common action would be to start an AssemblyLine. The timer is
such an example where the "external" event is the clock reaching a
specific time. Other external events are either asynchronous such as the TCP port
EventHandler that waits for incoming TCP connections. Others may initiate some
connection and poll for events. An example of the latter is the mailbox
listener. Please consult each EventHandler's configuration for more details on
how they work and how to use them.
Simple EventHandlers (formerly known as triggers)
Version 4.5 - EventHandlers
|