camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 차정호 <jh...@barunmo.com>
Subject How do I maintain custom ojbect in the camel context scope?
Date Wed, 28 Oct 2015 15:26:59 GMT
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.

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message