Apama 10.3.1 | Apama Documentation | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The File IAF Adapter (JMultiFileTransport) | Opening files for reading
 
Opening files for reading
 
Opening files for reading with parallel processing applications
The File adapter can read from multiple files at the same time. Send an OpenFileForReading event for each file you want the File adapter to read. This involves emitting an event to the channel specified in the adapter's configuration file, typically FILE, for example:
emit OpenFileForReading(...) to "FILE"
See the com.apama.file package in the API Reference for EPL (ApamaDoc) for detailed information on the OpenFileForReading event.
Parameter
Description
transportName
Name of the transport being used within the File adapter. This must match the transport name specified in the IAF configuration file so that the transport can recognize events intended for it.
requestId
Request identifier for this open file event. The response, which is either a FileHandle event or a FileError event, contains this identifier.
codec
Name of the codec to use with the file. This must match one of the codecs specified in the adapter-static.xml IAF configuration file. When you want the File adapter to read and write entire lines of data just as they are, specify the null codec (JNullCodec). When you want the File adapter to interpret file lines in some way, you can specify either the CSV codec (JCSVCodec) or the Fixed Width codec (JFixedWidthCodec) according to how the data in the file is formatted. To open fixed width or CSV files, you must add some information to the payload field of the OpenFileForReading event. The codecs needs this information to correctly interpret the data. For details about adding to the payload field, see Opening comma separated values (CSV) files or Opening fixed width files.
filename
Absolute path, or file pattern (for example, *.txt, *.csv) within absolute directory path if intending to read all files matching a pattern in order of last time modified. While a relative path might work, an absolute path is recommended. A relative path must be relative to where the IAF has been started, which can be unpredictable. For example:
c:\logfiles\*.log
/user/local/jcasablancas/logfiles/*.log
linesInHeader
The number of lines in the header, or 0 if there is no header. Text files sometimes contain a number of lines at the beginning of the file that explain the format. As these are usually of some specific format, the Apama File adapter cannot interpret them. By skipping these lines, the File adapter can process just the data contained in the file.
acceptedLinePattern
Regular expression pattern (in the same format supported by Java) to use to match lines to read. The File adapter reads only those lines that match this pattern. To read all lines, specify an empty string.
payload
String dictionary for storing extra fields for use with codecs. For fixed width files the following fields make up the payload; for other types of files, they will be ignored.
*sequence<integer> fieldLengths
The length (number of characters) in each field, in order, where the number of fields is given by fieldLengths.size()
*boolean isLeftAligned
Whether the data in the field is aligned to the left or not (that is, right aligned)
*string padCharacter
The pad character used when the data is less than the width of the field
For CSV files, the following field makes up the payload; for other types of files it will be ignored.
*string separator
The separator character

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.