Hi,
I have questions regarding the camel-spring-redis component.
I have a rabbitmq producer that send out a json. 
>From other people's suggestions I took the json and converts into a Map
which I can then use simple expression language. 
Below is my configuration:

        <route id="oplogconsumer:insert:redis">
            <from
uri="spring-amqp:mongo-tail:mongo-insert:i?autodelete=false&amp;durable=true&amp;type=direct"
/>
            <unmarshal>
                <json library="Jackson"/>
            </unmarshal>

            <log message="Insert Operation: Message available on a RabbitMQ
Queue" />
            <to uri="stream:out" />
        
            <setHeader
headerName="CamelRedis.Key"><simple>${body[type]}</simple></setHeader>
            <setHeader
headerName="CamelRedis.Value"><simple>${body[${body[id]}]}</simple></setHeader>
           <to
uri="spring-redis://localhost:6379?command=HMSET&amp;serializer=#redisserializer"/>

Below is the Exchange when I sent the data:

Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
        Id                  ID-MRT-GMH1119-59671-1418324483776-0-2
        ExchangePattern     InOptionalOut
        Headers            
{breadcrumbId=ID-MRT-GMH1119-59671-1418324483776-0-1,
CamelRedelivered=false, CamelRedeliveryCounter=0, CamelRedis.Key=tags,
CamelRedis.Value={createdOn=2014-11-24T10:13:21.444Z, modifiedOn=null,
attributes=[{name=Crib 1, value=Inventory}, {name=Access, value=Level1}],
tagId=testme8}, contentEncoding=null, contentType=null, correlationId=null,
expiration=null, messageId=null, priority=null, replyTo=null, type=null}
        BodyType            java.util.HashMap
        Body                {id=testme8,
testme8={createdOn=2014-11-24T10:13:21.444Z, modifiedOn=null,
attributes=[{name=Crib 1, value=Inventory}, {name=Access, value=Level1}],
tagId=testme8}, op=i, objectId=5489ea111c64c229e3627bdc, type=tags}
]

Stacktrace

java.lang.NullPointerException
        at
org.springframework.data.redis.core.DefaultHashOperations.putAll(DefaultHashOperations.java:115)
        at
org.apache.camel.component.redis.RedisClient.hmset(RedisClient.java:45)
        at
org.apache.camel.component.redis.CommandDispatcher.execute(CommandDispatcher.java:136)
        at
org.apache.camel.component.redis.RedisProducer.process(RedisProducer.java:35)

So it looks the key or the map is not set correctly.
According to http://camel.apache.org/redis.html, here is how I should the
HMSET opertaion
HMSET   Set multiple hash fields to multiple values     CamelRedis.Key (String),
CamelRedis.Values(Map<String, Object>)  void
In the code above I have unmarshalled the json into a map so why am I
getting this exception?
Any thoughts or suggestions?
Gordon



--
View this message in context: 
http://camel.465427.n5.nabble.com/HMSET-problem-with-Camel-Spring-Redis-component-tp5760598.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to