Coherence Adapter in SOA
12c
Coherence
adapter is one of the new features in Oracle SOA 12c. Coherence cache is act
like a store where we can put database data and made it available for different
application, Coherence cache serves as intermediary between database and client
application.
The operations
that we can perform using coherence adapter are:
- Put
- Get
- Remove
- Query
In this post,
I am going to explain how to configure coherence adapter in oracle soa 12c for
Put and Get operations. I have create a database table contains header details
and this sample need to fetch the header details from database table by passing
some parameter value. In this process, we will implement coherence adapter with
Get and Put operations. Get operation is used fetch the values that are available
in coherence and Put operation is to insert values into coherence if the values
are not available.
Firstly, drag
and drop a BPEL process and configure it with one way template and default
request schema.
XSD schema
for this sample is shown below.
Overview of
the project looks like below.
Add a
parameter for the query to fetch the values based on parameter value as show
below.
Next, drag
the Coherence Adapter to configuration with Get operation.
Give the
coherence connection JNDI name as per below and click on Next.
Check the
Get operation and click on Next.
We use the
default catch name as “adapter-local” for this sample.
Key value
is “input”. This is the request schema element name and click on Next.
Choose the
schema QueryHeaderInfo_table.xsd, which is generated from DB adapter table and
click on Next.
Click Finish.
Next, drag
the Coherence Adapter to configuration with Get operation.
Give the
coherence connection JNDI name as per below and click on Next.
Check the
Put operation and click on Next.
We use the
default catch name as “adapter-local” for this sample.
Key value
is “input”. This is the request schema element name and click on Next.
Choose the
schema QueryHeaderInfo_table.xsd, which is generated from DB adapter table and
click on Next.
Click
Finish.
Overview of
the BPEL is show below.
Drag an
invoke activity to integrate with Query Coherence adapter to get the header
details from coherence catch.
Add assign activity
to map parameter value to get operation coherence adapter as shown below.
Add a
property jca.coherence.Key with value from $inputVaiable in invoke activity.
Drag IF
condition after invoke activity to verify the values for the parameter are available
on not in coherence catch.
By using
below count condition for coherence adapter response, we can verify.
If we get
values, then flow will exit with empty activity and if we don’t have any values
in coherence cache, we can continue the flow in else condition as show below.
Invoke DB
adapter to get the values from database by mapping request value to parameter using
assign activity as shown below.
Drag
another invoke to integrate Put Coherence Adapter and add the property
jca.coherence.Key with value form $inputvariable.
Deploy the
project and test it.
Good Luck JJ
how to do query operation?
ReplyDeleteFor query operation, we need to configure coherence key property while using put operation. Based on the key value we can perform query operation. Key value can be auto generated value or we can configure some unique element (like ID) value.
Delete