I've a situation where I want to define a non null Map variable in Camel route and put value into it. But I couldn't find a way to do that.
I tried defining a map by setting resultType as "java.util.HashMap" in setProperty field.But I got NullPointerException.
<route id = "update_fields">
<from uri ="direct:update_fields"/>
<setProperty propertyName="fieldMap">
<simple resultType="java.util.HashMap">[:]</simple>
</setProperty>
<groovy>exchange.getProperty('fieldMap').put(body.rId,body.b_id)</groovy>
</route>
Use groovy language ala:
<setProperty propertyName="fieldMap">
<groovy>new HashMap()</groovy>
</setProperty>