Skip to content

Startup Triggers

dizzzz edited this page Nov 12, 2014 · 10 revisions

In conf.xml two different types of StartupTriggers can be defined to ensure a JMS listener is available after database startup.

Replication: ReceiverStartupTrigger

This has been already documented in replication documentation.

General: XQueryStartupTrigger

Arbitrary xquery scripts can be launched automatically from the /db/system/autostart collection. Scripts can start both messaging and replication listeners.

The template is already available in conf.xml (must be removed from comments)

<!-- 
  XQueryStartupTrigger will execute all xquery scripts stored in the
  /db/system/autostart collection during startup of the database. 

  The collection must be owned by SYSTEM/DBA mode "rwxrwx___" (0770)
  Each of the scripts must be owned by a DBA user, group DBA, 
  mode "rwxrwx___" (0770) with mime-type "application/xquery". 
  The name of the scripts must end with ".xq", ".xqy" or ".xquery".
-->
<trigger class="org.exist.collections.triggers.XQueryStartupTrigger"/>

Legacy

For older versions of eXist-db the trigger was part of the first implementations of the replication/messaging extension;

this feature has been removed with v0.9.0

<startup>
    <triggers>     
        <trigger class="org.exist.messaging.receive.XqueryStartupTrigger">
            <parameter name="xquery" value="/db/script1.xq"/>
            <parameter name="xquery" value="/db/script2.xq"/>
        </trigger>      
    </triggers>
</startup>

Please note that the org.exist.messaging.receive.XqueryStartupTrigger will not work when the extension is executed from a XAR file. For this the JAR files of the XAR must be extracted into lib/user

Clone this wiki locally