Developing Apama Applications > Developing Adapters > Apama File Adapter > Requesting data from the file
Requesting data from the file
After your application receives a FileHandle event, it can emit a ReadLines event, which signals the adapter to start reading lines from the file. The definition of the ReadLines event is as follows:
event ReadLines
{
/* The name of the transport being used within the file adapter */
string transportName;
 
/* request Id */
integer requestId;
 
/* The session Id this read line event is coming from */
integer sessionId;
 
/* The number of lines to read. As each line is read, a FileLine
event will be sent from the Adapter in response to this request.
When opening a single file, the adapter will continue to probe
the file until lines are available.
 
If a wildcard pattern was specified and the end of file is
reached before the specified number of lines have been read,
the file will be closed, an EndOfFile event will be sent, and
if a new file is available, it will send a NewFileOpened event
and read the remaining number of lines from this. If a new file
is not available, the adapter will wait until one is available.
*/
integer numberOfLines;
}
The sessionId in the ReadLines event must be the same as the sessionId stored in the FileHandle event that the application received when the file was opened.
The adapter tries to read as many lines as specified in the ReadLines event. If the file does not contain that many lines, what the adapter does depends on whether the original OpenFileToRead event specified a specific file or a wildcard pattern. According to that setting, the adapter either waits until the file contains more data, or tries to open a new file to deliver the balance from.
Copyright © 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.