Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Camel Redis Automatically Prepends String to Key

$
0
0

I'm using the Redis component in my Camel application. One issue is that it automatically prepends strings to keys. For example, let's say I run the following in my Camel app:

        from("direct://path/to/store/in/redis")            .setHeader(RedisConstants.COMMAND, constant("SET"))            .setHeader(RedisConstants.KEY, constant("key"))            .setHeader(RedisConstants.VALUE, constant("value"))            .to(spring-redis://localhost:6379);

Then, if I open my command-line Redis client and run the following to list all keys in the DB:

> keys *

it returns:

1) "\xac\xed\x00\x05t\x00\x03key"

Here you can see that it prepended \xac\xed\x00\x05t\x00\x03 to the key, and I'm not sure where exactly it does that.

This wouldn't be a problem if I was only using the GET and SET Redis commands, because for some reason it prepends the same string to the key for these commands, so there's no key mis-match. However, if I try to perform a different Redis command, like KEYS, through the Camel app, like this:

from("direct://some/other/path/to/redis")        .setHeader(RedisConstants.COMMAND, constant("KEYS"))        .setHeader(RedisConstants.PATTERN, constant("*"))        .to(spring-redis://localhost:6379);

it prepends a slightly different string to the asterisk, which results in the query not returning anything because there are no matches to the pattern. That is, the

> KEYS * 

command translates to something like the following in Redis:

> KEYS "\xac\xed\x00\x05t\x00\x05t*"

Any thoughts on this?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>