Apama 10.7.2 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The File IAF Adapter (JMultiFileTransport) | Opening files for writing | Opening files for writing with parallel processing applications
 
Opening files for writing with parallel processing applications
If your Apama application implements parallel processing, you may want to increase parallelism by processing the incoming events from the File adapter in a separate, private, context, rather than doing everything in the correlator's main context. To request that events from the File adapter are sent to the private context your monitor is running in, the monitor should open the file using the com.apama.file.OpenFileForWritingToContext event instead of OpenFileForWriting. The OpenFileForWritingToContext event has a field that contains a standard OpenFileForWriting event (see Opening files for writing), in addition to a field specifying the context that file adapter events should go to for processing, (which is usually the context the monitor itself is running in, context.current()), and the name of the channel the File adapter is using. When using the OpenFileForWritingToContext event, the OpenFileForWritingToContext event and all other File adapter events must not be emitted directly to the adapter, but rather enqueued to the correlator's main context, where the adapter service monitor runs. The File adapter's service monitor is responsible for emitting the events that are enqueued from other contexts to the File adapter, and for enqueuing the events received from the File adapter to whichever context should process them (as specified in the OpenFileForWritingToContext event).
See the com.apama.file package in the API Reference for EPL (ApamaDoc) for detailed information on the OpenFileForWritingToContext event.
Using the OpenFileForWritingToContext event is similar to using the OpenFileForReadingToContext event. See Opening files for reading with parallel processing applications for an example use of the OpenFileForReadingToContext event.