More about Service File rules
|
|
Each file listener data instance references a single Service File rule. At runtime, the listener monitors the contents of a directory to look for files of a specific name (or name pattern). When an eligible input file is discovered, it is copied into a subdirectory folder named Work
and deleted from the original directory.
The listener cause the associated Service File rule to start. (If authentication is required, the Operator ID and password in the listener are used, resulting in a full requestor session. The Service File rule parses the input according to instructions in the Request and Method tabs. When an input file is completely processed without error, it is copied to the Completed
folder and deleted from the Work
folder.
The system places output text files in a subdirectory of the original directory named Report
. Output files have a file type of rpt
.
The system saves results and errors from Service File processing in persistent instances of the Log-Service-File class, ordered by date and time. This Log instance contains information about the file name, file size, and errors. You can use the Class Explorer to review these (as XML displays in Internet Explorer), or create reports using list view or summary view rules.
To include the clipboard results of service file processing in the Pega log, temporarily add the Log-Message method as a step in an appropriate place in the service activity. Set the LoggingLevel parameter to InfoForced
and the Message parameter to:
Contents of page:\n" + myStepPage.getXML());
The CSV (Comma Separated Values) file format is supported by Microsoft Excel and many other programs for simple interchange of flat-file data. If your application needs to import data from CSV files, your Service File rules can use a Parse Delimited rule. For an example, see PDN article 25573 How to parse a Comma-Separated-Values (CSV) file using a file service.
(An older approach using function rules is also available. See 25485 How to parse Comma-Separated Value files.)
A Service File rule can accept arriving PDF form documents completed by customers, Web site visitors, or other sources, and use a Parse Structured rule (Rule-Parse-Structured rule type) to copy the form to the clipboard. An activity can then extract the completed form fields from the PDF form.
See the PDN document Working with PDF forms and Documents for more information about incoming PDF forms.
You can debug a Service File rule or rules using remote logging. Install the Apache LogFactor5 applet on a workstation and identify this workstation as the target for remote logging in the File Listener form.
Through changes the prlogging.xml
file, you can obtain performance statistics on the execution of services. See Performance tool — Statistics for services.
Through settings in the prconfig.xml
file, you can be alerted to unusually long service operations. See How to detect lengthy service operations.
As an alternative to the prconfig.xml file, you can use Dynamic System Settings to configure your application.
See How to create or update a prconfig setting.
For a PDN example of a multithreaded file service, see PDN article 25603 How to support high-throughput file services with multithreading.
remote logging, service | |
About File Listener data instances
About Parse Structured rules About Parse Delimited rules |