rss
SOATUBE
Oracle
Custom Search SOABYTE here

Monday, November 8, 2010

JCA Dynamic "Partnerlinks" in SOA 11g

In SOA 11G the JCA Binding Component allows the invoker of a JCA reference to specify the

JCA connection factory JNDI dynamically at runtime - on a per message basis - using a
normalized message header property.
The following demonstrates how to use Dynamic JCA JNDI in BPEL, where the dynamic part
is the .jca config file <connection-factory> location attribute, e.g.
<adapter-config name="FtpOutbound" adapter="Ftp Adapter" ...

    <connection-factory location="eis/ftp/anonymous" />
The dynamic part can also be non-managed properties, i.e. not the JNDI name
<adapter-config name="FtpOutbound" adapter="Ftp Adapter" ...

    <connection-factory>
      <non-managed-connection managedConnectionFactoryClassName="oracle.tip.adapter.ftp.FTPManagedConnectionFactory">
        <property name="Host" value="my.ftpsrv.com"/>
        <property name="Port" value="21"/>
        <property name="Username" value="anonymous"/>
        <property name="Password" value="jjoe@domain.com"/>
      </non-managed-connection>
    </connection-factory>
In short that means that at Invoke (run-)time the BPEL process (or any JCA Reference invoker)
can decide which JCA Connection Factory (JNDI entry) to use, thus overriding the (default)
JNDI location present in the .jca config file, by setting the reserved normalized message header property
"jca.jndi", for example (in BPEL)
<assign>
     <copy>
         <from expression="'eis/ftp/myftpserver'"/>
         <to variable="jndiLocation"/>
     </copy>
   </assign>

   <invoke name="send" partnerLink="Outbound" portType="ns1:Outbound_PortType"
           operation="Write" inputVariable="inputMessage">

     <bpelx:inputProperty name="jca.jndi" variable="jndiLocation"/>

   </invoke>
Another example overriding one or more non-managed properties already in the .jca file:
<assign>
     <copy>
         <from expression="'my.other.ftpsrv.com'"/>
         <to variable="host"/>
     </copy>
     <copy>
         <from expression="'scott'"/>
         <to variable="user"/>
     </copy>
   </assign>

   <invoke name="send" partnerLink="Outbound" portType="ns1:Outbound_PortType"
           operation="Write" inputVariable="inputMessage">

     <bpelx:inputProperty name="jca.mcf.Host" variable="host"/>
     <bpelx:inputProperty name="jca.mcf.Username" variable="user"/>

   </invoke>
Here is a similar example using Mediator:
<assign>
    <copy target="$out.property.jca.jndi" value="eis/ftp/myftpserver"/>
</assign>
A prerequisite is (trivially) that the dynamically chosen JNDI names at runtime
must already be defined and available in the adapters weblogic-ra.xml for the
particular JCA resource adapter servicing the reference invocation.

0 comments:

Post a Comment

 
Blogger Profile