@Override public boolean exists(String queueName, String id) { DynoQueue queue = queues.get(queueName); return Optional.ofNullable(queue.get(id)).isPresent(); } }
@Override public boolean pushIfNotExists(String queueName, String id, long offsetTimeInSecond) { DynoQueue queue = queues.get(queueName); if (queue.get(id) != null) { return false; } Message msg = new Message(id, null); msg.setTimeout(offsetTimeInSecond, TimeUnit.SECONDS); queue.push(Collections.singletonList(msg)); return true; }
@Override public Message get(String messageId) { for (DynoQueue q : queues.values()) { Message msg = q.get(messageId); if (msg != null) { return msg; } } return null; }
@Override public boolean exists(String queueName, String id) { DynoQueue queue = queues.get(queueName); return Optional.ofNullable(queue.get(id)).isPresent(); } }
@Override public boolean pushIfNotExists(String queueName, String id, long offsetTimeInSecond) { DynoQueue queue = queues.get(queueName); if (queue.get(id) != null) { return false; } Message msg = new Message(id, null); msg.setTimeout(offsetTimeInSecond, TimeUnit.SECONDS); queue.push(Collections.singletonList(msg)); return true; }