The following article summarizes the inbound (polling) adapter configurations for Oracle SOA 11g when configuring multiple threads.
In an earlier posting, I mentioned that you can configure multiple threads of inbound (polling) adapters for Oracle SOA. However, the ways to configure multiple threads varies between adapters and product versions, and the information is scattered cross multiple pieces of documentation. Therefore, it is worth consolidating them here. The following describes how to configure Adapter threads in Oracle SOA 11G:
1. JMS Adapter
<service name="dequeue" ui:wsdlLocation="dequeue.wsdl"> <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/jms/textmessageusingqueues/textmessageusingqueues/dequeue%2F#wsdl.interface(Consume_Message_ptt)"/> <binding.jca config="dequeue_jms.jca"> <property name="adapter.jms.receive.threads" type="xs:string" many="false">10</property> </binding.jca"> </service>
2. AQ Adapter
<service name="dequeue" ui:wsdlLocation="dequeue.wsdl"> <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/aq/raw/raw/dequeue/#wsdl.interface(Dequeue_ptt)"/> <binding.jca config="dequeue_aq.jca"> <property name="adapter.aq.dequeue.threads" type="xs:string" many="false">10</property> </binding.jca> </service>
3. MQ Adapter
4. Database Adapter
It takes multiple steps to configure database adapter threads.
Step 1: Configure distributed polling. The query in the polling database adapter needs to be a distributed polling in order to avoid data duplication. Please follow the two best practices in the documentation to establish the right kind of distributed polling.
Step 2. Set activationInstances as adapter binding property at composite.xml (SOA 11G) to achieve multiple threads in database adapter.
Alternatively, you can set NumberOfThreads in the jca file (SOA 126.96.36.199 onward). Technically, activationInstances and NumberOfThreads properties work differently, in such that NumberOfThreads works in the scope of per activation agent. Before SOA 188.8.131.52, NumberOfThreads is NOT supported in clustered environment or when activationInstances>1. From SOA 184.108.40.206 onward, you can use either activationInstances or NumberOfThreads properties to achieve the multi-threading effect. But if for some reason you set both, the total concurrent threads will be activationInstances x NumberOfThreads. For example, if you activationInstances=2, and NumberOfThreads=5, that means there are are 5 threads running within each activation instance.
Step 3. Tune MaxTransactionSize and MaxRaiseSize to throttle the incoming messages along side with activationAgents/NumberOfThreads. These two properties are configured either through the DbAdapter wizard at JDeveloper, or manually directly at the *.jca file.
<endpoint-activation portType="poll_ptt" operation="receive"> <activation-spec className="oracle.tip.adapter.db.DBActivationSpec"> ... <property name="PollingStrategy" value="LogicalDeletePollingStrategy"/> <property name="MaxRaiseSize" value="5"/> <property name="MaxTransactionSize" value="10"/> ... </activation-spec> </endpoint-activation>
5. File/FTP Adapter
File/FTP adapter's threading model is a bit complex. In essence, there is a separation poller thread and processor thread, except in the "Single Threaded Model" (comparatively, JMS/AQ adapters always use the same thread to poll and process). There is always only one poller thread, while there could be multiple processor threads. Please go through the documentation thoroughly so that you can choose a threading model appropriate to your application.
Step 2: Configure threads depending on the threading model you choose
If you choose the Default Threading Model, you can set the thread count of global processor through the oracle.tip.adapter.file.numProcessorThreads property at the pc.properties file. This pc.properties is read from the classpath. So you could, for example, copy it to some directory under ORACLE_HOME and then reference it in the WLS classpath in setDomainEnv.sh. However, the Partition Threading Model is recommended over the Default Threading Model (see below) if you do have a need to define processor threads.
If you choose the Single Threaded Model, set the SingleThreadModel=true at the *.jca file. And as the name applies, you don't worry about any thread counts.
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec"> <property../> <property name="SingleThreadModel" value="true"/> <property../> </activation-spec>
If you choose the Partitioned Threaded Model, you can set the thread count for processor threads per adapter at the *.jca file:
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec"> <property../> <property name="ThreadCount" value="4"/> <property../> </activation-spec>
Please note the value of the ThreadCount is closely related to the kind of threading model you choose: