Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 615
J Fritsch Avatar asked Oct 20 '25 04:10

J Fritsch


1 Answers

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>
like image 173
G Quintana Avatar answered Oct 26 '25 10:10

G Quintana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!