Using the File Binding Component
Processing Protocols and Capabilities
The consumer mode in JBI or the server side processing activities are referred as Inbound processing. Error Handling and Recovery are an examples for Inbound processing.
The provider mode in JBI or the client side processing activities are referred to as Outbound processing. File write and on-demand read protocols will be covered in this section.
The following list describes the Inbound processing file poll protocols and their capabilities:
- Polling for file(s) in a specified directory.
- Instead of renaming the original files, create a work directory relative to the input directory. Name of the work directory is configurable via the workArea setting in file:address, with the default being "filebc-in-processing".
- Move each input file to work directory, and tag the original file names with a UUID.
- Inbound worker thread reads files from the work directory and processes contents as follows:
- If multiple records per file setting is false (default), the content of the file will be treated as the payload and set in the normalized message content.
- If multiple records per file is true, create separate normalized messages one for each record. How a record is read from the file depends on maxBytesPerRecord and recordDelimiter settings.
- All successfully processed input files will be archived, if the "archive" setting is true.
- A "processed_files" directory will be created relative to the input directory
- Original files will be renamed with “_processed” suffix and put into the "processed_files" directory
In case of errors while processing an input file:
- An "error" folder will be included in the "new" folder created by the Binding Component in the input directory.
- Original UUID tagged file (from the work directory) will be moved to the errors directory and a additional file with "_error" suffix will be generated. "_error" file will contain details of the failure.
Recovery is a mechanism used to prevent message loss in case of system crash.
On startup, Inbound Processor will first check the work directory and put any unprocessed files in the queue for the worker thread. This ensures that any files left unprocessed in the work directory will be processed when the systems restarts.
The following list describes the Outbound processing file write protocols and their capabilities:
- Writing file(s) in a specified directory
- Write single (overwrite mode) or multiple records (append mode) to a file
- On Demand Read function acts when a JBI service invokes the File Binding Component to read a specific message from a file directory.
- Protects existing files in a directory from being overwritten by new files with the same name
- If staging attribute is true, and not in append mode (multiple records per file), Outbound messages are written first to a staging directory, then the completed file is moved to target directory. This ensures that the output file is exposed only when message has been written completely.
Return to GlassFish ESB Documentation Home