Home   Documentation   Demonstrations   Download

AMICO: Documentation / AMICO Modules / Event-Handler

 

Simple response to changes of AMICO variables.

How To Run

     java -jar %AMICO_HOME%/bin/amico-event-handler.jar [<conf-url>]

 

 

Configuration Files

 

A main configuration file:
 

This is a minimal configuration file that uses default parameters for missing attributes.
Use this file if you want to use default settings.

---------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<event-handler>
    <event-handler-adapter url="file:conf/event-handler/event-handlers.xml"/>
</event-handler>

This is a full configuration file that overrides default parameters.

---------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<event-handler>
    <communicator host="localhost" port="3320">
        <!-- Basic parameter for establishing connection with communicator. Module uses TCP connection.
             <command> element define a list of commands that will be sent to communicator
             each time a module establish a connection (see AMICO TCP protocol for details on commands)
        -->

        <command>UPDATE last-loaded-module EH</command>
        <command>ONUNLOAD DELETE last-loaded-module</command>
    </communicator>


    <event-handler-adapter url="file:conf/event-handler/event-handlers.xml"/>
</event-handler>

 

 A configuration file for AMICO event handler adapter (linked from a main configuration file):
 

<?xml version="1.0" encoding="UTF-8"?>

<event-handlers>

    <event-handler trigger="test[.='xml']" trigger-on-every-update="true"
                           type="xml" input-type="url"
                           input="file:conf/event-handler/commands.xml" xslt-url="">

        <variable name="user-id" value="&lt;%=user-id%&gt;"/>

    </event-handler>

    <event-handler trigger="test[.='xslt']" trigger-on-every-update="true"

                           type="xml" input-type="empty"
                           input="" xslt-url="file:conf/event-handler/derived-commands.xsl">

        <parameter name="numberOfSteps" value="&lt;%=number%&gt;"/>

        <parameter name="startNumber" value="&lt;%=number%&gt;"/> 

        <parameter name="user-id" value="&lt;%=user-id%&gt;"/-->

    </event-handler>

    <event-handler trigger="test[.='list']" trigger-on-every-update="true" type="list">

        <command timeOffsetMs="1000">UPDATE-DIRECT age 12</command>

        <command timeOffsetMs="1000">UPDATE-DIRECT age 13</command>

        <command timeOffsetMs="1000">UPDATE-DIRECT age 20</command>

        <command timeOffsetMs="1000">UPDATE-DIRECT age 30</command>

    </event-handler>

    <event-handler trigger="a" trigger-on-every-update="true" type="list">

        <command timeOffsetMs="10">UPDATE-DIRECT b 1</command>

        <command timeOffsetMs="10">UPDATE-DIRECT b 2</command>

    </event-handler>

</event-handlers>

 

 

Each event-handler is runs a sequence of command when trigger variable is changed. Sequence of commands can be given as list, as a link to a file that contains list of commands, or to a XSLT that derives list of commands. XSLT file can also receive parameters.

 

Validation Logos