我想使用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}]

尽管有很多关于如何订阅等的例子,但我没有找到一个关于如何设置键/值对的例子。我该怎么做?

最佳答案

CamelRedis.KeyCamelRedis.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>

10-08 15:37