General

Windows Service application enables automatic batch processing of input data files. It "watches" selected folder for new files and uses them as arguments for predefined command.

Installation

Windows Service can be installed by issuing following command:
Bsds.Service -install 

and uninstalled by typing:
Bsds.Service -uninstall 

It can also be run as an ordinary console application by using -console options.
The id of the service and the description are specified in configuration file.

Configuration

Window service application requires additional configuration apart from general one (see Configuration).
  <!-- BSDS Service configuration -->
  <appSettings>
    <add key="commandTemplate" value="/upload=@filename /name=test /entity=xxx"/>
    <add key="inputFolderPath" value="c:\tmp\bsdsdata"/>
    <add key="maxFileCopyTime" value="00:01:00"/>

    <add key="geocodedFilesPergingInDays" value="1"/>
    <add key="successFilesPergingInDays" value="1"/>
    <add key="failedFilesPergingInDays" value="1"/>
    
    <add key="cleanTempAfterEachCommand" value="true"/>

    <add key="serviceId" value="Sample_id"/>
    <add key="serviceDescription" value="Sample description"/>
  </appSettings>

There are three options which need to be set:
  1. commandTemplate - command which is run when new file is detected in a watch folder. All occurrences of @filename are substituted with actual file's name.
  2. inputFolderPath - folder to be watched.
  3. maxFileCopyTime - maximal time to wait until input file is fully copied to watch folder.
  4. geocodedFilesPergingInDays - the amount of days after which geocode result files will be automatically deleted. If equals "0" files are never deleted.
  5. successFilesPergingInDays - the amount of days after which sucessfully processed files will be automatically deleted. If equals "0" files are never deleted.
  6. failedFilesPergingInDays - the amount of days after which failed files will be automatically deleted. If equals "0" files are never deleted.
  7. cleanTempAfterEachCommand - the flag indicating if temp files should be deleted automatically
  8. serviceId - identifier to be used when installing and uninstalling windows service.
  9. serviceDescription - name which will be visible in Services Explorer (services.msc).

Usaged

Windows service can be run using Services Explorer *services.msc" tool. Please make sure that user account used by the service has all necessary permissions to operate in a watch folder.
When run service waits for input files to be copied to a watch folder. During its operation it writes all status information to BSDS.log file stored in a folder where .exe file is located.
The watch folder has following structure:
/watchFolder
    /success
    /failed
    /geocoded
    /processing
        /tmp
    inputfile.csv

When new file is detected, a configured command is fired (all temporary files are stored in "processing" folder). When command finishes its work the input file is moved
either to "success" folder or to "failed" depending on command's results (all diagnostic information is sent to a log file as well).

The syntax of geocode command from service client differs from the console client version. The option /outfile is not supported. Instead a geocode result file 
is automatically stored in geocoded folder and automatically deleted after "geocodedFilesPergingInDays" days.

Last edited Aug 11, 2011 at 7:26 PM by tmasternak, version 16

Comments

No comments yet.