Prerequisites
- WmEhcacheTransactionManager.jar should be present under <IntergrationServer_dir>/lib/jars folder. (This is required only if planning to use xa or xa_strict transaction. This jar contains Transaction Manager Lookup implementation which is required by Ehcache for XA transactions)
Configuration
Transactions are enabled on a cache by cache basis
with the transactionalMode cache attribute.
The allowed values are:
The default value is off.
Local Transactions:
Enabling a cache for local transactions is shown in the following example:
- Shutdown your CacheManager from IS admin
- Shutdown terracotta server (if using for distributed caching)
- Open <IntergrationServer_dir>/config/Caching/<CacheManagerName>.xml file
-
Add transactionMode attribute to desired cache element as shown below:
<cache name="localCache"
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="1"
transactionalMode="local">
</cache>
- Save file and Start terracotta server (if using for distributed caching)
- Start your CacheManager from IS admin
- If CacheManager started successfully then you are good to go and use transaction services from WxEhcache package.
- If CacheManager does not start successfully then please try restarting Integration Server and then Starting Cache Manager again.
XA or XA_STRICT Transactions:
Enabling a cache for xa or xa_strict transactions is shown in the following example:
- Shutdown your CacheManager from IS admin
- Shutdown terracotta server (if using for distributed caching)
- Open <IntergrationServer_dir>/config/Caching/<CacheManagerName>.xml file
-
Add below transactionManagerLookup tag in XML file.
<transactionManagerLookup
class= "com.wm.ehcache.transactionmanager.WmTransactionManagerLookup"
properties="" propertySeparator=":"/>
-
Add transactionMode attribute to desired cache element as shown below:
<cache name="xaCache"
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="1"
transactionalMode="xa">
</cache>
- Save file and Start terracotta server (if using for distributed caching)
- Start your CacheManager from IS admin
- If CacheManager started successfully then you are good to go and use transaction services from WxEhcache package.
- If CacheManager does not start successfully then please try restarting Integration Server and then Starting Cache Manager again.