Hi,

I am implementing custom Endpoint by extending Camel-Cache. I have done
following  steps for that

Classes involve
1) MyCamelCacheComponent extends CacheComponent - Custom Endpoint factory
and manager class class to introduce new custom components
2) MyCamelCacheEndpoint extends CacheEndpoin - Endpoint class to to
implements methods of producer and consumer
3) MyCamelCacheConsumer extends CacheConsumer - Service to consume request
at the start of route. Also consuming message exchanges from the endpoint
via a Processor when creating consumer
4) NdsCamelCacheProducer extends CacheProducer - Service consumer to
dispatch outgoing requests and receive incoming and sending message exchange
to the endpoint
5) MyCamelCacheProcessor implements Processor - handles business logic
related cachec check and store back  for LFU, LFR

Files
ehcache.xml has multiple cache configuration. see example route as same name
in URI as cache name so run time cache conf can be pickuped up runtime and
handle multiple cache in generic way using getCache(cache name) on
cacheManacger in createEndpoint method of NdsCamelCacheComponent.java
<cache name="MyCache"
        maxEntriesLocalHeap="10000"
        maxEntriesLocalDisk="1000"
        eternal="false"
        diskSpoolBufferSizeMB="20"
        timeToIdleSeconds="300" timeToLiveSeconds="600"
        memoryStoreEvictionPolicy="LFU"
        transactionalMode="off">
        <persistence strategy="localTempSwap" />
</cache>

ssue I want help on
MyCamelCacheComponent.java has method
@Override
protected MyCamelCacheEndpoint createEndpoint(String uri, String remaining,
Map parameters) throws Exception {
    MyCamelCacheEndpoint endpoint = new MyCamelCacheEndpoint(uri, this,
configuration,cacheManagerFactory);
    setProperties(endpoint, parameters);
    return endpoint;
}

above method expecting CacheConfiguration, and CacheManagerFactory

for CacheManagerFactory is method below (working fine)
public CacheManagerFactory getCacheManagerFactory() {
    cacheManagerFactory = new
DefaultCacheManagerFactory(getClass().getResourceAsStream(configurationFile),
configurationFile);
    return cacheManagerFactory;
}

but to getting CacheConfiguration i am facing issue, please see line below
to get CacheConfiguration
cacheManagerFactory.getInstance().getCache(remaining).getCacheConfiguration();
getCacheConfiguration() method returns CacheConfiguration  of
net.sf.ehcache.Cache.CacheConfiguration and expected is
org.apache.camel.component.cache.CacheConfiguration

need some advice about how to get
org.apache.camel.component.cache.CacheConfiguration  from
cacheManagerFactory 

Any advice or may be any best way to write custom Cache component If I am
not doing right way




--
View this message in context: 
http://camel.465427.n5.nabble.com/Custom-Camel-CacheEndpoint-help-tp5772752.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to