REQUIREMENT contrib.filewatcher |
Type | NEW |
Priority | HIGH |
Status | CLOSED |
Topic | You can publish messages by putting files on a certain location in the file system. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Des cription |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example any |
Testing your filter pattern You have two options to test your regular expression or your 'simple' filter in your configuration. First, you can use the Further you can test the pattern on command line: java org.xmlBlaster.contrib.filewatcher.DirectoryManager -path /tmp/filewatcher -filter "*.xml" -filterType simple java org.xmlBlaster.contrib.filewatcher.DirectoryManager -path /tmp/filewatcher -filter "hi.*\.xml" -filterType regex |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Configure |
The plugin is configured in the xmlBlasterPlugins.xml configuration file. Here an example where all properties are used: <xmlBlaster> ... <plugin id='FileWatcherPlugin' className='org.xmlBlaster.contrib.filewatcher.FileWatcherPlugin'> <attribute id='mom.topicName'>watcher.test</attribute> <attribute id='mom.publishKey'><key oid='watcher.test'><watcher><test/></watcher></key></attribute> <attribute id='mom.publishQos'><qos><expiration lifeTime='4000'/></qos></attribute> <attribute id='mom.connectQos'></attribute> <attribute id='mom.loginName'>fritz</attribute> <attribute id='mom.password'>secret</attribute> <attribute id='filewatcher.directoryName'>/tmp/fileWatcher</attribute> <attribute id='filewatcher.maximumFileSize'>10000000</attribute> <attribute id='filewatcher.delaySinceLastFileChange'>10000</attribute> <attribute id='filewatcher.pollInterval'>2000</attribute> <attribute id='filewatcher.sent'>Sent</attribute> <attribute id='filewatcher.discarded'>Discarded</attribute> <attribute id='filewatcher.fileFilter'></attribute> <attribute id='filewatcher.lockExtention'>*.lck</attribute> <attribute id='filewatcher.filterType'>simple</attribute> <action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/> <action do='STOP' onShutdownRunlevel='6' sequence='5'/> </plugin> ... </xmlBlaster>and here a configuration for a filewatcher which has to be part of a file replication (i.e. which has to be monitored by a replication monitor: <plugin create="true" id='fileSet02' className='org.xmlBlaster.contrib.filewatcher.FileWatcherPlugin'> <attribute id='filewatcher.directoryName'>/tmp/fileWatcher</attribute> <attribute id='mom.publishQos'><qos><persistent/></qos></attribute> <attribute id='mom.loginName'>watcher01/1</attribute> <attribute id='mom.password'>secret</attribute> <!-- maximum file size would be 2 GB in this case --> <attribute id='filewatcher.maximumFileSize'>2147483648</attribute> <!-- maximum chunk size would be 256 kB in this case --> <attribute id='filewatcher.maximumChunkSize'>262144</attribute> <!-- optimistically waits 10 minutes after last change in file size --> <attribute id='filewatcher.delaySinceLastFileChange'>600000</attribute> <!-- polls every 5 minutes to see if there are new files --> <attribute id='filewatcher.pollInterval'>300000</attribute> <attribute id='filewatcher.sent'>Sent</attribute> <attribute id='filewatcher.discarded'>Discarded</attribute> <attribute id='filewatcher.filterType'>simple</attribute> <!-- this token will be replaced with the id of the plugin: here 'fileSet02' --> <attribute id='replication.prefix'>${id}</attribute> <action do='LOAD' onStartupRunlevel='7' sequence='3' onFail='resource.configuration.pluginFailed'/> <action do='STOP' onShutdownRunlevel='6' sequence='7'/> </plugin>and here a minimalistic one: <xmlBlaster> ... <plugin id='FileWatcherPlugin' className='org.xmlBlaster.client.filewatcher.FileWatcherPlugin'> <attribute id='filewatcher.directoryName'>/tmp/fileWatcher</attribute> <attribute id='mom.topicName'>watcher.test</attribute> <!-- determines on which level to start/shutdown the plugin and what to do in case of an exception --> <action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/> <action do='STOP' onShutdownRunlevel='6' sequence='5'/> </plugin> ... </xmlBlaster>and here a more detailed description about each attribute:
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See REQ | engine.runlevel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See TEST | org.xmlBlaster.test.contrib.TestFileWatcherPlugin |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/contrib.filewatcher.xml