J Fritsch
J Fritsch

Reputation: 3358

Set redis key/value with camel-redis

I want to set a key/value pair using camel-redis. I try:

spring-redis://localhost:6379?command=SET&CamelRedis.key=testkey&CamelRedis.value=100

but no joy. I get the error:

There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{key=testkey, value=100}]

Although there are plenty of examples about how to subscribe etc. I do not find a single example on how to set a key/value pair. How would I do that?

Upvotes: 4

Views: 3336

Answers (1)

G Quintana
G Quintana

Reputation: 4667

CamelRedis.Key and CamelRedis.Value (beware they are case sensitive) are message headers not URI parameters

<route>
    <from  uri="direct:intput"/>
    <setHeader headerName="CamelRedis.Key"><constant>testkey</constant></setHeader>
    <setHeader headerName="CamelRedis.Value"><constant>100</constant></setHeader>
    <to uri="spring-redis://localhost:6379?command=SET"/>
</route>

Upvotes: 5

Related Questions