我想使用camel-redis设置键/值对。我试试:
spring-redis://localhost:6379?command=SET&CamelRedis.key=testkey&CamelRedis.value=100
但没有快乐。我收到错误:
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}]
虽然有很多关于如何订阅的例子,但我没有找到关于如何设置键/值对的单一示例。我该怎么做?
答案 0 :(得分:3)
CamelRedis.Key
和CamelRedis.Value
(请注意它们区分大小写)是邮件头而不是URI参数
<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>