Accessing Coherence Cluster Using Spring Bean on SOA SUITE 11g
By Jay Lee on Sep 18, 2011
Following solution was tested on SOA SUITE 220.127.116.11 with Coherence 3.6.0. There might be other way like below to access coherence cluster from SOA SUITE.
Coherence cache-config is pre-defined for SOA Cluster, and all SOA composite application will inherit this. This cache-config is zipped in fabric-runtime.jar as name of soa-coherence-cache-config.xml(This can be observed with logs from clustered managed server) And tangosol-coherence-override.xml is also included in fabric-runtime.jar and enforce SOA server to use cache-config included in fabric-runtime.jar(As a result, -Dtangosol.coherence.cacheconfig in setDomainEnv cannot precede this)
I've tried out several options to make the whole thing work and this is what I found relatively cleaner solution than others. I will use Coherence*Extend and Spring Bean in SOA SUITE 11g.
1. Extract tangosol-coherence-override.xml and soa-coherence-cache-config.xml from fabric-runtime.jar($WLS_HOME/Oracle_SOA1/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar)
Edit the tangosol-coherence-override.xml file.
CHANGE the cache-config param to locate your own cache-conifg file. This have to be created based on the soa-coherence-cache-config.xml included in fabric-runtime.jar. THIS FILE WILL BE USED IN STEP 2.
Add the remote-scheme in the soa-coherence-cache-config.xml file.
2. Go to SOA Domain HOME, and modify setDomainEnv.sh. SET -Dtangosol.coherence.override to the file we extracted and modified in step1.
3. Configure Coherence Cluster to have TCP*Extend proxy. (This is simple enough, so omitted for brevity)
4. We will use Spring Bean instead of Java Embedding for coding convenience. In SOA project, create one interface and one class. as below.
5. Drag&Drop Spring Context from Component Palette to Composite Diagram, Select 'Create New Context' to create new spring bean context file.Open up newly created file.
And drag&drop "Service" from right pane. After you add Service, bean definition will be created.
6. Wire BPEL(or Mediator) to Spring Context and Implement it appropriately(Add 'ASSIGN' and 'INVOKE')
7. It's all set to go now. Just one more trivial thing to do is, add 'wlfullclient.jar' and 'jps-internal.jar' into CLASSPATH of Coherence cache servers, so it won't complaint about "ClassNotFound"
There might be more nicer way than this. I'll be looking for it.