使用 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屋!
查看全文