Hello All,
I hope you have a good weekend. I have some questions regarding the code to write in a Listener such as an AsyncEventListener to get a reference to a cache when the listener is deployed in a server. I tried to deployed a simple AsyncEventlistener on a server. So I Create a event queue from gfsh Create an Asynchronous Event Queue: create async-event-queue --id=myAEQ --listener=pymma.testgeode01.MyFirstAsynchronousEventListener --parallel=true Create a region :create region --name=customerRegion --type=PARTITION --group=groupA --async-event-queue-id=myAEQ In the example given in the Java doc http://geode.apache.org/releases/latest/javadoc/index.html the access to the cache is provided by a CacheHelper: final Region duplicateRegion = CacheHelper.getCache().getRegion(originalRegionName + "_DUP"); Since I did not find any reference to what a Cache Helper is and from where it comes from, at the first glance, in my current POC, I created my own cache helper with the static method getCache. public static Cache getCache () { Properties properties = new Properties(); properties.setProperty("locators","localhost[10334]"); Cache cache = new CacheFactory(properties).create(); return cache; } It could be also a Clientcache. In my example I duplicated the entries from customerRegion to another region and it works well. Nevertheless, since the Listener is deployed in a server itself, I though that a reference to the cache could be given to the event by a more direct way. The interface AsyncEventListener is outside the scope of this topic. I tried to search if there was not a special class CacheHelper and I found one similar named CacheRegionHelper. But without documentation in the Java API I did not want to use it. So if Geode community has few minutes to reply, I would like to ask these questions: In the example provided in the API, what is The CacheHelper? Is it a class provided in Geode Libraries or do we need to develop by ourself. In that case, Do we consider the CacheHelper as a regular client and use the cache factory to create it?. Or does it exist a direct way to access to a cache reference through the Server the listener is deploy in? Or may be there is another solution I completely missed? Thank you for your help. Best regards Paul
