I recently started exploring redisson for one of the use-case, where the map should hold string & queue of pojo objects. I tried to add the objects to queue for a particular key but when I'm retrieving it's values, it is giving empty results.
@Autowired
private RedissonClient redissonClient;
private RMapCache<String, Queue<AbstractXXXEvent>> mapCache;
@PostConstruct()
public void init() {
this.mapCache = redissonClient.getMapCache("test8", JsonJacksonCodec.INSTANCE);
}
@PreDestroy
public void cleanup() {
if (Objects.nonNull(redissonClient)) {
redissonClient.shutdown();
}
}
@RestController
class TestController {
@GetMapping("/get")
public Set<Map.Entry<String, Queue<AbstractXXXEvent>>> get() {
return mapCache.entrySet();
}
@PostMapping("/post")
public void post() {
mapCache.put("test", new ConcurrentLinkedQueue<>());
Queue<AbstractXXXEvent> queue = mapCache.get("test");
queue.add(new aXXXEvent().setDescription("compile done"));
queue.add(new bXXXEvent());
queue.add(new cXXXEvent().setDescription("completed"));
}
}
When I do a get request, it is giving the empty result with given key ex: [{"test":[]}]
. Kindly provide your suggestions on how to fix this.