Dear Camel developers and users,
I like to share some data among routes in the same camel context.
For example, camel context scoped cache object.
I know CamelContext have the below methods :
package org.apache.camel;
…
public interface CamelContext extends SuspendableService,
RuntimeConfiguration {
…
/**
* Sets the properties that can be referenced in the camel context
*
* @param properties properties
*/
void setProperties(Map<String, String> properties);
/**
* Gets the properties that can be referenced in the camel context
*
* @return the properties
*/
Map<String, String> getProperties();
But in this case, I cannot add other type value except the String type
value.
So I cannot code like this :
Map<String, String> properties = new HashMap<>();
properties.put(“cache”, new HashMap<String, String>()); <-- compile
error : The method put(String, String) in the type Map<String,String> is
not applicable for the arguments (String, HashMap<String,String>)
camelContext.setProperties(properties);
Is there another good solution in this case ?
Thanks a lot before.
Jung-Ho Cha,
a Camel rider.