Tuesday, June 1, 2010

Configuration and preference properties in BPEL and Adapters @ Composite

Configuration and preference properties are always used extensively in most of the projects. So a developer needs to be aware about the changes that have happened from 10g to 11g.

BPEL

In 10g the property values which had to be updated at runtime from BPEL Console were defined as preference property. Process level configuration settings were defined using the configuration properties in bpel.xml.

Coming to 11g, to define configuration properties and values for a BPEL process, add the properties under the service component section of the composite.xml file.

Code Snippet composite.xml

 <component name="BPELPropertiesTest">
    <implementation.bpel src=” BPELPropertiesTest.bpel"/>
        <property name="bpel.config.completionPersistPolicy">true</property>
  </component>
</component>

How to use preference properties in BPEL is well explained in the Eric Elzinga blog


Define properties in composite.xml under the component tag.

Code Snippet of composite.xml

<component name="PreferencesTest">

<implementation.bpel src="PreferencesTest.bpel"/>

<property name="bpel.preference.id">4402</property>

<property name="bpel.preference.name">Geo Tho</property>

</component>

Access these preferences in Assign activity using the ora:getPreference() XPath function

Code Snippet of .bpel

<assign name="AssignManagerDetails">

……………

<copy>

<from expression="ora:getPreference('id') "/>

<to variable="Manager" part="payload"

query="/client:processResponse/client:id"/>

</copy>

……

</assign>

The difference here is that instead of going to BPEL Console in 10g you will need to explore the System MBean browser to update these preference properties.

You can right click on soa_infra >Administration > System Mean Browser

Navigate to Application Defined MBeans > oracle.soa.config > Server : soa_server1 > SCAComposite > ProjectName > SCAComposite.SCAComponent > BPELProcessName.

Click Properties. It will list you all the properties that you can update.

Adapters

In case of Adapters the properties will be present in both Composite.xml and Adapter JCA file.

In case of File/FTP adapter, most of the properties are present in the jca file that gets generated as part of the File adapter. In case you select the logical directory, then value of the directory should be entered in composite.xml.

Code Snippet of composite.xml

<reference name="FileWrite" ui:wsdlLocation="FileWrite.wsdl">

<interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/file/GenericApp/PropertiesTest/FileWrite#wsdl.interface(Write_ptt)"/>

<binding.jca config="FileWrite_file.jca"/>

<property name="folder" type="xs:string" many="false" override="may">C:\temp</property>

</reference>

Code Snippet of File Adapter jca file

<adapter-config name="FileWrite" adapter="File Adapter" wsdlLocation="FileWrite.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

<connection-factory location="eis/FileAdapter" adapterRef=""/>

<endpoint-interaction portType="Write_ptt" operation="Write">

<interaction-spec className="oracle.tip.adapter.file.outbound.FileInteractionSpec">

<property name="LogicalDirectory" value="folder"/>

<property name="FileNamingConvention" value="bpel_%yyMMddHHmmss%.txt"/>

<property name="Append" value="false"/>

<property name="NumberMessages" value="1"/>

</interaction-spec>

</endpoint-interaction>

</adapter-config>

All these end point properties can be updated at runtime from the Enterprose manager. Navigate to

Soa-infra > Composite process > Service/References Properties > AdapterName



In case of DB adapter, most of the operation related properties are present in the jca file that gets generated as part of the DB adapter. The connection related properties like retry count, retry interval are specified in composite.xml.

Code Snippet of composite.xml

<reference name="DBWrite" ui:wsdlLocation="DBWrite.wsdl">

<interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/db/GenericApp/PropertiesTest/DBWrite#wsdl.interface(DBWrite_ptt)"/>

<binding.jca config="DBWrite_db.jca"/>

<property name="jca.retry.count" type="xs:int" many="false" override="may">4</property>

<property name="jca.retry.interval" type="xs:int" many="false"

override="may">1</property>

<property name="jca.retry.backoff" type="xs:int" many="false"

override="may">2</property>

<property name="jca.retry.maxInterval" type="xs:string" many="false"

override="may">120</property>

</reference>

Code Snippet of DB Adapter jca file

<adapter-config name="DBWrite" adapter="Database Adapter" wsdlLocation="DBWrite.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

<connection-factory location="eis/DB/p2icoeSOADEMO" UIConnectionName="p2icoeSOADEMO" adapterRef=""/>

<endpoint-interaction portType="DBWrite_ptt" operation="insert">

<interaction-spec className="oracle.tip.adapter.db.DBWriteInteractionSpec">

<property name="DescriptorName" value="DBWrite.Employees"/>

<property name="DmlType" value="insert"/>

<property name="MappingsMetaDataURL" value="DBWrite-or-mappings.xml"/>

<property name="DetectOmissions" value="true"/>

<property name="GetActiveUnitOfWork" value="false"/>

</interaction-spec>

</endpoint-interaction>

</adapter-config>

All these end point properties can be updated at runtime from the Enterprise manager. Navigate to

Soa-infra > Composite process > Service/References Properties > AdapterName




6 comments:

prem said...

george
any idea how we pass dynamic filename while reading a file in 11g.

George Thomas said...

While reading files using file adapter, dynamic file names can be given for Sync-read option.Assign the dynamic file name to a variable. The jca.file.FileName property can be assigned in the 'properties' tab in Invoke activity. The value will be the variable to which the file name was assigned.

Anonymous said...

Hi George,

I am having trouble roll backing the message to the queue. My BPEL process is recives the message the from queue using the JMS adapter and on runtime fault the message is not going to the queue as expected. Is there any property to be set on inbound jms adapter or on the bpel process.

Greatly appreciate your help.

Anonymous said...

Hello George,
Thanks for the wonderful documentation, It really helped. I have one question, after creating preference property in composite, in the em , I could not see that property to edit after clicking properties in the system bean, could you let me know how to edit the preference variable.
Thanks

George Thomas said...

In the below blog u have screenshots,which will help you in finding the properties

http://eelzinga.wordpress.com/2009/10/28/oracle-soa-suite-11g-setting-and-getting-preferences/

Anonymous said...

Thanks for the Nice Post