Developing Apama Applications > Developing Adapters > Standard Apama Adapters > 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 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.