Inbound file integration
The base configuration of PolicyCenter includes classes that support file-based input with high-performance multi-threaded processing. PolicyCenter provides two classes, one for processing message replies, and one as a startable plugin.
You cannot modify the code in the plugin implementation class in Studio, but you can use one or more instances of these integrations to work with your own file data.
Inbound file integration proceeds in the following stages.
- In response to an inbound event that is specific to your requirements, your own integration code creates a new file in a specified incoming directory on the local file system.
- The inbound file integration class polls the incoming directory at a specified interval and detects
any new files since the last time checked.
The order of the processing of individual files in the directory is undefined. Never rely on the order being any particular order, such as alphabetic or creation date.
- The inbound file integration class moves all found files to the processing directory, which stores inbound files in progress.
- The inbound file integration class opens each new file using a specified character set. The default is UTF-8, but it is configurable.
- The inbound file integration class reads one unit of work and dispatches it to your handler code. The
processingmode subelement in the inbound-integration-config.xml file
defines the type of data processed in one unit of work. If that subelement has the value
line, PolicyCenter sends one line at a time to the handler as aStringobject. If that subelement has the valuefile, PolicyCenter sends the entire file to the handler as a java.nio.file.Path object.If an exception occurs during processing, the plugin class moves the file to the error directory. The value of the stoponerror subelement does not affect this behavior. The file name is changed to add a prefix that includes the time of the error, which is expressed in milliseconds as returned from the Java time utilities. For example, if the file name ABC.txt has an error, it is renamed in the error directory with a name similar to 1864733246512.error.ABC.txt.
To retry a failed inbound file, your inbound file integration class must move the file from the error directory back into the incoming directory for reprocessing.
- After successfully reading and processing the complete file, the inbound file integration class moves the file to the done directory.
- If there were any other files detected in this polling interval in step 2, the inbound file integration class repeats the process at step 4. Optionally, you can set the integration to operate on the most recent batch of files in parallel. For related information, see the ordered subelement.
- The inbound file integration class waits until the next polling interval, and repeats this process starting at step 3.
