Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 2.53 KB

File metadata and controls

37 lines (23 loc) · 2.53 KB

[Previous] [Up] [Next]

Defining Event Handlers

Defining an event handler is surprisingly easy. At least, it's surprising to me. Maybe it will be to you as well.

The Event Handler XML Element

You probably already guessed that it would be an XML element.

The event handler demonstrated in the sample pipeline is in sample-pipeline.xml. Here's the event definition in all its glory:

<pipelineEvent name="data-receipt" pipelineName="sample"
               enableOnClusterStart="false"
               directory="${ziggy.pipeline.data.receipt.dir}"/>

The pipelineEvent element straightforwardly defines the name of the event handler itself and the name of the pipeline it starts. The enableOnClusterStart attribute tells Ziggy whether the event handler should be enabled immediately when you type ziggy cluster start, or whether it should require a human to go in and turn it on via the console after the cluster is already up and running.

The directory attribute is, of course, the directory where the event handler looks for its ready files. In this case, the data receipt event handler looks for ready files in the same directory where the data receipt pipeline node looks for files (or directories of files). That was a design choice, though you wouldn't need to do it that way: you could have a totally separate directory for the event handler to watch, if such was your preference.

Note here that a Ziggy property can be used in the directory attribute. This allows you to specify all the watched directories in the properties file. Note that this is the only attribute or element in all of Ziggy's XML infrastructure that allows the use of property expansion notation! That's strictly because it's the only place where we thought we needed it. If you need this added to some other part of the XML infrastructure for your purposes, let us know. We can make it happen!

[Previous] [Up] [Next]