[Index]

events:file-watch-service


Provide a service for subscribers to watch a file system for Files existing, being created or being modified.

If the file is created during subscription the consumer may receive a notification for the same file twice. Once the subscription has succeeded a consumer should receive every creation and modification happening to the file.

If this service is stopped no notification is sent to consumers. Consumers must use the state of this service to know that it has stopped.

Consumers will receive creation and modification events on a different thread to the initial event if the file exists.

Implementation Note: This facility is still a work in progress. Requiring this service in a configuration is messy. In future releases this service should be hidden from users.


Property Summary

filter  
kinds Kinds of events to watch.
name The name of this service.
numberOfConsumers  

Example Summary

Example 1 Trigger when two files arrive.

Property Detail

filter

Configured ByATTRIBUTE
AccessREAD_WRITE

kinds

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

Kinds of events to watch.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The name of this service.

numberOfConsumers

AccessREAD_ONLY


Examples

Example 1

Trigger when two files arrive.

<oddjob>
    <job>
        <sequential>
            <jobs>
                <mkdir dir="${some.dir}/etc" name="Create Test Dir"/>
                <events:file-watch-service id="file-watch" kinds="ENTRY_CREATE" xmlns:events="oddjob:events"/>
                <events:when id="both-files" name="When Both Files" xmlns:events="oddjob:events">
                    <jobs>
                        <events:list eventOperator="ALL">
                            <child>
                                <events:file-watch name="Watch File 1">
                                    <fileWatch>
                                        <value value="${file-watch}"/>
                                    </fileWatch>
                                    <file>
                                        <value value="${some.dir}/file1.txt"/>
                                    </file>
                                </events:file-watch>
                                <events:file-watch name="Watch File 2">
                                    <fileWatch>
                                        <value value="${file-watch}"/>
                                    </fileWatch>
                                    <file>
                                        <value value="${some.dir}/file2.txt"/>
                                    </file>
                                </events:file-watch>
                            </child>
                        </events:list>
                        <echo id="task">${both-files.trigger.ofs}</echo>
                    </jobs>
                </events:when>
                <folder>
                    <jobs>
                        <copy id="createFile1" name="Create File 1" to="${some.dir}/file1.txt">
                            <input>
                                <buffer>Test1</buffer>
                            </input>
                        </copy>
                        <copy id="createFile2" name="Create File 2" to="${some.dir}/file2.txt">
                            <input>
                                <buffer>Test2</buffer>
                            </input>
                        </copy>
                        <delete name="Delete All Test Files">
                            <files>
                                <files files="${some.dir}/*"/>
                            </files>
                        </delete>
                    </jobs>
                </folder>
            </jobs>
        </sequential>
    </job>
</oddjob>


(c) R Gordon Ltd 2005 - Present