使用camel-redis设置redis键/值

J F*_*sch 4 apache-camel redis

我想使用camel-redis 设置键/值对。我尝试:

spring-redis://localhost:6379?command=SET&CamelRedis.key=testkey&CamelRedis.value=100
Run Code Online (Sandbox Code Playgroud)

但没有喜悦。我收到错误:

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}]
Run Code Online (Sandbox Code Playgroud)

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

G Q*_*ana 5

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>
Run Code Online (Sandbox Code Playgroud)