camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmh <gordon...@gmail.com>
Subject LinkedHashMap vs HashMap for Camel redis hmset operation
Date Fri, 12 Dec 2014 15:33:47 GMT
Hi,
I have a json that needs to be converted into a map.
I used Jackson as  dataformat and then gson 

<unmarshal ref="gson"/>

I noticed instead of hashmap I get linkedHashMap in the exchange

  BodyType            java.util.LinkedHashMap
  Body                {op=i, type=zones, objectId=548b083fb90a1072097cdeed,
id=Zone-cbs, Zone-cbs={createdOn=2014-11-24T10:13:21.444Z, modifiedOn=null,
attributes=[{name=Crib 1, value=Inventory}, {name=Access, value=Level1}],
zoneId=Zone-cbs}}

I am using the map for inserting into redis hshmap (hmset)

I have exceptions later on that complains about 

java.lang.ClassCastException: java.util.ArrayList cannot be cast to
java.lang.String
        at
org.springframework.data.redis.serializer.StringRedisSerializer.serialize(StringRedisSerializer.java:32)
        at
org.springframework.data.redis.core.AbstractOperations.rawHashValue(AbstractOperations.java:145)
        at
org.springframework.data.redis.core.DefaultHashOperations.putAll(DefaultHashOperations.java:124)
        at
org.apache.camel.component.redis.RedisClient.hmset(RedisClient.java:45)

I know in the Camel redis hmset code it is expecting java.util.Map.

see

    public void hmset(String key, Map<String, Object> param) {
        redisTemplate.opsForHash().putAll(key, param);
    }

Does it make a difference if it getting linkHashMap instead of Map?
How do I make sure I get java.util.Map object back?
Gordon



--
View this message in context: http://camel.465427.n5.nabble.com/LinkedHashMap-vs-HashMap-for-Camel-redis-hmset-operation-tp5760637.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message