0 Replies Latest reply: Mar 29, 2012 7:42 AM by 694204 RSS

    Unable to get NamedCacheLifecycleEvent events fired. Coherence 3.6

    694204
      Hi,

      I have a namespace content handler (based on an IndexHandler sample I found on the forums). However in my case rather than a NamedCacheStorageRealizedEvent I want to be notified when a Cache is started and then pass in some information from my extensible XML to a scheduler that will schedule at a fixed rate the class specified (in order to pick up new data from a DB and load into the cache). However I seem unable to set the filter correctly. I can pick up NamedCacheStoredRealizedEvents fine but this is not what I want as I get loads of them for all the coherence common/processing pattern caches.

      The code in the Element Handler is :-

      registerContentHandler("task", new ElementContentHandler()
                {
                     public Object onElement(ConfigurationContext configurationContext,
                                                   QualifiedName qualifiedName,
                                                   XmlElement xmlElement) throws ConfigurationException {
                                         
                          EventDispatcher eventDispatcher = configurationContext.getEnvironment().getResource(EventDispatcher.class);
                eventDispatcher.registerEventProcessor(new NamedCacheLifecycleEventFilter("my-cache-name"), new CacheIndexAdder(taskName));
                          return null;
                     }

      The config of the cache is:-

      <caching-scheme-mapping>
                <cache-mapping>
                     <cache-name>mars-data-mars-commodity</cache-name>
                     <scheme-name>DS-MarsData</scheme-name>
                </cache-mapping>
                <cache-mapping>
                     <cache-name>geo-data-*</cache-name>
                     <scheme-name>DS-GeoData</scheme-name>
                </cache-mapping>
           </caching-scheme-mapping>

           <caching-schemes>

                <distributed-scheme>
                     <scheme-name>DS-MarsData</scheme-name>
                     <service-name>MarsData (Distributed)</service-name>
                     <serializer>
                          <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                          <init-params>
                               <init-param>
                                    <param-type>java.lang.String</param-type>
                                    <param-value>esl-extensible-pof-config.xml</param-value>
                               </init-param>
                          </init-params>
                     </serializer>
                     <thread-count>5</thread-count>
                     <local-storage system-property="mars.localstorage">true</local-storage>
                     <backing-map-scheme>
                          <read-write-backing-map-scheme>
                               <internal-cache-scheme>
                                    <local-scheme>
                                         <unit-calculator>BINARY</unit-calculator>
                                    </local-scheme>
                               </internal-cache-scheme>
                               <write-delay>0</write-delay>
                               <rollback-cachestore-failures>false</rollback-cachestore-failures>
                          </read-write-backing-map-scheme>
                     </backing-map-scheme>
                     <autostart>true</autostart>
                </distributed-scheme>