I'm playing with Spring/Redis/Jedis for a simple message queue system. I've brought up a simple test case using just Strings, but for some reason the strings are coming back corrupted. I was originally trying with POJOs, but that also had corruption, so I figured just simple strings would work, but so far no luck.
When I use redis-cli and subscribe to the channel the raw data it shows me is
1) "message"
2) "test"
3) "\xac\xed\x00\x05t\x00\x03wee"
Here is my sample code
@Service
public class MessageService {
@Autowired private RedisTemplate<String, String> testTemplate;
@Bean
RedisMessageListenerContainer container(JedisConnectionFactory jedisConnectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(jedisConnectionFactory);
container.addMessageListener(listenerAdapter, new PatternTopic("test"));
return container;
}
@Bean
MessageListenerAdapter listenerAdapter() {
return new MessageListenerAdapter(this, "receiveMessage");
}
public void sendMessage(){
TestObject message = new TestObject();
message.test = 5;
testTemplate.convertAndSend("test", "wee");
}
public void receiveMessage(String testObject) {
System.out.println("I got a message " + testObject);
}
}
The output from receieveMessage is I got a message ?? t wee
, well there are two characters that can't be displayed in stackoverflow where the spaces are before and after the 't'.
Any ideas as to what is causing this corruption?