4

I'm using Redisson client to publish String messages on a topic, but for some reasons, the published messages always contain some weird characters at the beginning:

eg: when I publish the string "{"event":"notification"}" at the redis level I end up with this: "\x04>\x18{"event":"notification"}"

1) "pmessage"
2) "*"
3) "active_project_users:1"
4) "\x04>\x18{\"event\":\"notification\"}"

Any idea how I can make those weird chars go away?

My java code looks like this:

 private void publish(String channel, String message) {       
        RTopic topic = redissonClient.getTopic(channel);
        topic.publish("{\"event\":\"notification\"}");
    }

I'm using redis:3.2 & radisson-spring-boot-starter 3.16.1

Thanks

Yonoss
  • 1,242
  • 5
  • 25
  • 41

1 Answers1

6

It seems I have to set the encoding for this to work properly:

RTopic topic = redissonClient.getTopic(channel, StringCodec.INSTANCE);
Yonoss
  • 1,242
  • 5
  • 25
  • 41