使用camel-redis设置Redis键/值 [英] Set redis key/value with camel-redis
本文介绍了使用camel-redis设置Redis键/值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用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?
推荐答案
CamelRedis.Key
和CamelRedis.Value
(请注意,它们区分大小写)是消息头而不是URI参数
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>
这篇关于使用camel-redis设置Redis键/值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文