Spring Boot Version - 1.5.2,
Gemfire version - 8.2.6 (Overriding the managed version 8.2.2),
RegionType - PARTITION_REDUNDANT,
Proxy - ClientRegionShortcut.PROXY,
Database - Cassandra
We are extending CacheWriterAdapter and overriding beforeCreate(), beforeUpdate(), beforeDestroy(). We are connecting to remote gemfire server using JAVA.
@Bean(name = GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME)
ClientCache gemfireCache(@Qualifier("gemfireProperties") Properties gemfireProperties,
@Value("${gemfire.locator1:localhost}") String locatorHost,
@Value("${gemfire.port1:10334}") int locatorPort) {
ClientCache gemfireCache = new ClientCacheFactory(gemfireProperties).addPoolLocator(locatorHost, locatorPort)
.setPdxSerializer(pdxSerializer()).setPdxReadSerialized(false).create();
return gemfireCache;
}
but for HTTP GET, PUT and POST every time beforeCreate() is invoked. However for HTTP DELETE beforeDestroy() is invoked. We also tried printing the boolean values from com/gemstone/gemfire/cache/Operation and detailed analysis is at the bottom. We want to understand
- why beforeUpdate is never invoked
- why isGet, isContanisKey is false for HTTP GET operation when data is present in gemfire cache
- Why isCreate is false for HTTP POST operation
- Why isUpdate is false for hTTP PUT operation
- Why old value is not fetched for HTTP PUT operation
Scenario -1 Gemfire - No records
Cassandra - Record available
Test Case - HTTP GET service called using existing data which is available in Cassandra not in Gemfire
Result - Cache Loader is invoked first and then CacheWriterAdapter's beforeCreate() invoked with operation as Local_LOAD_CREATE
getNewValue- Object fetched
getOldValue- null
IsLoad-true
IsLocalLoad-true
IsLocal-false
isGetEntry-false
isSearchOrLoad-true
isUpdate-false
isCreate-true
isDestroy-false
isGet-false
isGetEntry-false
isContainsKey-false
isContainsValue-false
isContainsValueForKey-false
Scenario -2
Gemfire - Record Available
Cassandra - Record available
Test Case - HTTP GET service called using existing data which is available in both Cassandra and Gemfire
Result - CacheWriterAdapter's beforeCreate() invoked with operation as Local_LOAD_CREATE
getNewValue- Object fetched
getOldValue- null
IsLoad--true
IsLocalLoad-true
IsLocal-false
isGetEntry-false
isSearchOrLoad-true
isUpdate-false
isCreate-true
isDestroy-false
isGet-false
isGetEntry-false
isContainsKey-false
isContainsValue-false
isContainsValueForKey-false
Scenario -3
Gemfire - No Record Available
Cassandra - No Record available
Test Case - HTTP PostOperation called using new set of data which is not present in Cassandra and Gemfire
Result - CacheWriterAdapter's beforeCreate() invoked with operation as CREATE
getNewValue- Object fetched
getOldValue- null
IsLoad--false
IsLocalLoad-false
IsLocal-false
isGetEntry-false
isNetLoad-false
isSearchOrLoad-false
isUpdate-false
isCreate-true
isDestroy-false
isGet-false
isGetEntry-false
isContainsKey-false
isContainsValue-false
isContainsValueForKey-false
isInvalidate-false
Scenario -4
Gemfire - Record Available
Cassandra - Record available
Application - HTTP PutOperation called using existing data which is available in Cassandra and Gemfire
Result - CacheWriterAdapter's beforeCreate() invoked with operation as CREATE
getNewValue- Object fetched
getOldValue- null
IsLoad--false
IsLocalLoad-false
IsLocal-false
isGetEntry-false
isNetLoad-false
isSearchOrLoad-false
isUpdate-false
isCreate-true
isDestroy-false
isGet-false
isGetEntry-false
isContainsKey-false
isContainsValue-false
isContainsValueForKey-false
isInvalidate-false
Scenario -5
Gemfire - Record Available
Cassandra - Record available
Application - HTTP DeleteOperation called using existing IMEI which is available in Cassandra and Gemfire
Result - CacheWriterAdapter's beforeDestroy() invoked with operation as DESTROY.
getNewValue- Object fetched
getOldValue- null
IsLoad--false
IsLocalLoad-false
IsLocal-false
isGetEntry-false
isNetLoad-false
isSearchOrLoad-false
isUpdate-false
isCreate-false
isDestroy-true
isGet-false
isGetEntry-false
isContainsKey-false
isContainsValue-false
isContainsValueForKey-false
isInvalidate-false
Is this the correct behavior?