Connecting Apama Applications to External Components > Using Standard Adapters > Using the Apama File Adapter > Sending the read request
Sending the read request
After you construct an OpenFileForReading event, emit it to the "FILE" channel. For example:
com.apama.file.OpenFileForReading openFileWeWantToRead :=
new com.apama.file.OpenFileForReading;
 
//populate the openFileWeWantToRead event
//..
//..
emit openFileWeWantToRead to "FILE";
Emitting an OpenFileForReading event from EPL code signals the File adapter to open the file. If the open operation is successful, the File adapter returns a FileHandle event, whose definition is as follows:
event FileHandle
{
/* The name of the transport being used within the file adapter */
string transportName;
 
/* Request ID this file handle is in response to. */
integer requestId;
 
/* Session ID to use for further communication with the
File adapter */
integer sessionId;
}
The sessionId is the most important field; all communication related to this file references this value.
If the open operation is unsuccessful, the File adapter returns a FileError event, whose definition is as follows:
event FileError
{
/* The name of the transport being used within the file adapter */
string transportName;
 
/* Request ID this file error is in response to. */
integer requestId;
 
/* This should contain relevant information as to why the
error occurred */
string message;
}
Copyright © 2013-2015 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.