Friday, October 5, 2012

File/FTP Adapter Threading Model – Oracle SOA Suite

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:
  • 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.


8 comments:

  1. Hi Albin,

    Can you please tell me how to set the polling frequency in sync read operation of file adapter in soa 11g ?

    ReplyDelete
    Replies
    1. Sync Read is used to synchronously read a single file using an invoke activity, the file should be available before the invoke executes.The polling frequency is not applicable for this.

      Whereas Read is a waiting call which polls a directory for files following certain patterns. It is used in conjuction with the receive activity.

      Delete
  2. Hello, i m new to soa 11g.n i m currently using jdev11.1.1.3.0..i have problem with file adapter..in this i create two files F1,F2.i want to read the file F1 and write it into F2.but i m not giving correct path details of F2.then at that time the file was read but not write..its giving error..so my question is where can i get that disappeared file?

    ReplyDelete
  3. Hi Albin,

    I created a sample application on list of files using file adapter. Could you please help me how to pick the file as per the current date.

    Regards,
    Mithun

    ReplyDelete
  4. Hi Albin,
    I want to read file with the gap of 3mint each. So FTP adapter read every file after 3mint. e.g I have 5 files and directory and my FTP adapter read 1st file and after 3 mint he read 2nd and so on. Please let me know any suggestion.

    Regards,

    ReplyDelete
  5. Hello Albin,

    I find the articles in your blog really interesting and helpful.
    I have a question. Does 11g File / FTP Adapter support writing multiple files in the same call or invocation.

    Thank you

    ReplyDelete
  6. Hello,

    Could you please tell how the Single Threaded Model and threadcount works in a cluster based osb environment

    ReplyDelete