File/FTP Adapter Threading Model – Oracle SOA Suite
The Oracle File and FTP Adapters use the following threading models:- Default Threading Model
- Modified Threading Model
Default Threading Model:
In the default threading model, a poller is created for each inbound Oracle File or FTP Adapter endpoint. The poller enqueues file metadata into an in-memory queue, which is processed by a global pool of processor threads. We can set the thread count of global processor through the oracle.tip.adapter.file.numProcessorThreads property at the pc.properties file. Create pc.properties file with this property and copy it to server and then reference it in the WLS classpath in setDomainEnv.sh.
The following steps highlight the functioning of the default threading model:
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property../>
<property name="SingleThreadModel" value="true"/>
<property../>
</activation-spec>
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property../>
<property name="ThreadCount" value="4"/>
<property../>
</activation-spec>
In the preceding example for defining the property for a partitioned model:
The following steps highlight the functioning of the default threading model:
- The poller periodically looks for files in the input directory. The interval at which the poller looks for files is specified using the PollingFrequency parameter in the inbound JCA file.
- For each new file that the poller detects in the configured inbound directory, the poller enqueues information such as file name, file directory, modified time, and file size into an internal in-memory queue.
- A global pool of processor worker threads waits to process from the in-memory queue.
- Processor worker threads pick up files from the internal queue, and perform the following actions:
- Stream the file content to an appropriate translator (for example, a translator for reading text, binary, XML, or opaque data.)
- Publishes the XML result from the translator to the SCA infrastructure.
- Performs the required post processing, such as deletion or archival after the file is processed.
Modified Threading Model:
We can modify the default threading behavior of Oracle File and FTP Adapters. Modifying the threading model results in a modified throttling behavior of Oracle File and FTP Adapters. The following sections describe the modified threading behavior of the Oracle File and FTP Adapters:- Single Threaded Model
- Partitioned Threaded Model
Single Threaded Model:
The single threaded model is a modified threaded model that enables the poller to assume the role of a processor. The poller thread processes the files in the same thread. The global pool of processor threads is not used in this model. You can define the property for a single threaded model in the inbound JCA file as follows:<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property../>
<property name="SingleThreadModel" value="true"/>
<property../>
</activation-spec>
Partitioned Threaded Model:
The partitioned threaded model is a modified threaded model in which the in-memory queue is partitioned and each composite application receives its own in-memory queue. The Oracle File and FTP Adapters are enabled to create their own processor threads rather than depend on the global pool of processor worker threads for processing the enqueued files. You can define the property for a partitioned model in the inbound JCA file as follows:<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property../>
<property name="ThreadCount" value="4"/>
<property../>
</activation-spec>
In the preceding example for defining the property for a partitioned model:
- If the ThreadCount property is set to 0, then the threading behavior is like that of the single threaded model.
- If the ThreadCount property is set to -1, then the global thread pool is used, as in the default threading model.
- The maximum value for the ThreadCount property is 40.