There are at least 2 benefits of caching:
• to reduce the processing/network loads, thus increase the performance & reduce the hardware costs
• to reduce the calls to paid services (e.g. postcode-directory webservice), hence reduce the costs
Simply saying, caching works like a table that you keep for a certain period of time. The table consists of a pair of a key/token and the data. For example, you have to build a proxy for CarPrice Webservice that has 2 input variables: the car type & the year, then you can combine these in a cache token such as cartype_year. The first time you call the OSB proxy with the arguments "BMW-X1" & "2011", the OSB business service will invoke the CarPrice webservice to get the response that will be saved in a cache with a token "BMW-X1_2011". Next time you call the OSB proxy again with the same input arguments, the OSB business service will use the cache token "BMW-X1_2011" to return the same result without invoking the external webservice.
It's easy to setup a cache in the OSB workshop/IDE:
• select your business service
• select the message handling tab
• expand the advanced setting
• check the "result caching" checkbox
• specify the key/token of the data (in xquery expression, you can use xpath to retrieve the values from your SOAP messages)
• specify how long OSB will keep the cache data (you can also query this from your SOAP messages using xquery)
In the OSB console:
• Operations > Configuration > Global Settings > enable result caching
• Project explorer (select your project) > operational settings tab > enable result caching
• You can also change/specify the OSB cache in the console (instead of using the OSB workshop/IDE): Project explorer (select your project) > configuration details tab
P.S. OSB caching makes use of the Oracle Coherence framework. Most of time you don't have to bother with this. When you install weblogic with standard setting, the installer will install & configure the Coherence automatically. However when you use a non standard configuration (e.g. clusters), you may need to configure the coherence appropriately.
The original post: http://soa-java.blogspot.com
Comments are welcome!
No comments:
Post a Comment