Configuring the File adapter
Before using the File adapter, you need to add information to the IAF configuration file used to start the adapter. When you add an adapter to an Apama project, a configuration file for each instance of the adapter is automatically created. Double-click the name of the adapter instance to open the configuration file in the adapter editor.
If you are using the Apama adapter editor in Software AG Designer, you can edit or add variables to the General Variables section as displayed on the Settings tab. For other properties, you need to edit the XML code directly; to do this, select the adapter editor's XML Source tab.
If you are not using Software AG Designer, the configuration file can be derived from the template adapters\config\File.xml.dist configuration file shipped with the Apama installation.
Caution: | Before changing any values, be sure to make a copy of the File.xml.dist file and give it a unique name, typically with an .xml extension instead of .xml.dist. |
The template configuration file references the
adapters\config\File-static.xml file using the XML
XInclude extension. The
File-static.xml file specifies the adapter's codec and its mapping rules. Normally you do not need to change any information in this file. See
The IAF configuration file for more information on the contents on an adapter's configuration file.
In Software AG Designer, adapters are configured using Apama's adapter editor. To open an adapter instance, in the Project Explorer, right-click on <project name> > Adapters > File Adapter > <instance name> and select Open Instance from the pop-up menu.
You can set the variables used by the File adapter in the main Settings tab. Values of the form ${...}, such as ${DefaultCorrelator:port} are set to the correct value automatically by the Apama project's default launch configuration and do not need to be modified. To configure other properties used by the adapter, edit the XML code directly by selecting the XML Source tab.
If you are not using Software AG Designer, all adapter properties are configured by editing the adapter .xml file in an XML or text editor.
Customize the following properties:
<logging level="INFO" file="logs/FileAdapter.log"/> If you start the IAF from the Management and Monitoring console, specify an absolute path for the log filename.
<classpath path="@ADAPTERS_JARDIR@/JNullCodec.jar" />
<classpath path="@ADAPTERS_JARDIR@/JFixedWidthCodec.jar" />
<classpath path="@ADAPTERS_JARDIR@/JCSVCodec.jar" />
<classpath path="@ADAPTERS_JARDIR@/JMultiFileTransport.jar" />
Replace @ADAPTERS_JARDIR@ with the actual path to the .jar files. Typically, this is the apama_install_dir\adapters\lib directory.
If you are using Software AG Designer, these jar files are automatically added to the classpath in the configuration file and you do not need to replace the @ADAPTERS_JARDIR@ token.
In the
<sink> and
<source> elements, replace
@CORRELATOR_HOST@ and
@CORRELATOR_PORT@ with valid attribute values:
<apama>
<sinks>
<sink host="@CORRELATOR_HOST@" port="@CORRELATOR_PORT@" />
</sinks>
<sources>
<source host="@CORRELATOR_HOST@" port="@CORRELATOR_PORT@"
channels="FILE" />
</sources>
</apama>
If you are using the adapter in an Apama project, the default launch configuration uses the default correlator host and port settings and you do not need to replace the @CORRELATOR_HOST@ and @CORRELATOR_PORT@ tokens.
<property name="simpleMode" value="false" /> Indicate whether or not to start the File adapter in simple mode. In simple mode, the File adapter reads lines from a single file or writes lines to a single file. In non-simple mode, you can use the fixed width or CSV codecs to decode/encode field data. Also, the File adapter can read/write to multiple files and additional controls are available for communication between the adapter and the correlator. Non-simple mode is recommended for most situations. Details about simple mode and non-simple mode are in the File.xml.dist file. If you are using Software AG Designer, switch to the adapter editor's XML Source tab if you want to view these details or to edit the settings.