Greetings, I am trying to use camel-ehcache with pure blueprint DSL and struggle to make it work. Could someone either help point me in the right direction or confirm that it is not possible?
I have done the following: downloaded karaf 4.4.3, and Java 11, run the following in karaf concole: feature:repo-add camel 3.20.2 feature:install camel feature:install camel-ehcache Then tried this route: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="CacheTest-ctx"> <route id="CacheTest"> <from uri="timer:onetime?repeatCount=1"/> <setBody> <constant>testbody</constant> </setBody> <setHeader name="CamelEhcacheKey"> <constant>testkey</constant> </setHeader> <to uri="ehcache:testcache?action=PUT"/> <setBody> <constant>empty</constant> </setBody> <to uri="ehcache:testcache?action=GET"/> <to uri="log:output?showAll=true"/> </route> </camelContext> </blueprint> The route run, but output showed that the key was not found in the cache (body was "empty" instead of "testbody"). I tried to add a sample xml configuration of the cache: <config xmlns="http://www.ehcache.org/v3"> <cache alias="testcache"> <key-type>java.lang.String</key-type> <value-type>java.lang.String</value-type> <expiry><ttl unit="seconds">30</ttl></expiry> <resources><heap unit="entries">10</heap></resources> </cache> </config> And used it in the route: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <bean id="cacheConfigurationURL" class="java.net.URL"> <argument value="file:deploy/ehcache.xml"/> </bean> <bean id="cacheConfigurationFile" class="org.ehcache.xml.XmlConfiguration"> <argument ref="cacheConfigurationURL"/> </bean> <bean id="cacheManager" class="org.ehcache.config.builders.CacheManagerBuilder" factory-method="newCacheManager"> <argument ref="cacheConfigurationFile"/> </bean> <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="CacheTest-ctx"> <route id="CacheTest"> <from uri="timer:onetime?repeatCount=1"/> <setBody> <constant>testbody</constant> </setBody> <setHeader name="CamelEhcacheKey"> <constant>testkey</constant> </setHeader> <to uri="ehcache:testcache?action=PUT&cacheManager=#cacheManager"/> <setBody> <constant>empty</constant> </setBody> <to uri="ehcache:testcache?action=GET&cacheManager=#cacheManager"/> <to uri="log:output?showAll=true"/> </route> </camelContext> </blueprint> but the route will not start up, providing java.lang.IllegalStateException: State is UNINITIALIZED exception. I understand that cacheManager.init have to be called before the route start, but could this be done with just blueprint DSL? I can not create a dummy bean and call this as a factory-method, as it returns void. I can not call it in a separate route with lower startup order, as it is not fast enough. Any suggestions? Mirek Borský