camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommaso <>
Subject camel-redis strings serialization
Date Tue, 10 Sep 2013 08:43:41 GMT
This is a question on stackoverflow as well:

I'm playing with camel and redis. I have a very short route:


Where splitMessage is the following: 

  public static List splitMessage(@Body String body) throws IOException { 
    List answer = new ArrayList();   
    JsonParser parser=new JsonParser(); 
    JsonObject jo=   (JsonObject)parser.parse(body);

    // I care only for the features array
    JsonArray features=jo.get("features").getAsJsonArray();

    for (JsonElement feature: features) {
         Message msg=new DefaultMessage();
         JsonObject jof=feature.getAsJsonObject();

         // get the key
         String id=jof.get("id").getAsString().toString();

         msg.setHeader(RedisConstants.KEY, id);
         msg.setHeader(RedisConstants.VALUE, jof.toString());
    return answer;

Everything runs smoothly, but when I check the redis db I see that the key
is: "\xac\xed\x00\x05t\x00\nci11361338"

and the same prefix "\xac\xed\x00\x05t\x00" is in the value.

Obviously the those printed by the System.out look fine.

As you see I tried to add a serializer, a StringRedisSerializer that I
defined in the Main like this:

  Main main = new Main();
  main.bind("serializer", new StringRedisSerializer());

But the result is the same (also using GenericToStringSerializer).

Is there something I'm missing?

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message