diff --git a/dyno-queues-redis/build.gradle b/dyno-queues-redis/build.gradle index 6a3356e..aaae130 100644 --- a/dyno-queues-redis/build.gradle +++ b/dyno-queues-redis/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'project-report' dependencies { compile project(':dyno-queues-core') compile "com.google.inject:guice:3.0" - compile "com.netflix.dyno:dyno-jedis:1.4.+" + compile "com.netflix.dyno:dyno-jedis:1.5.5+" compile "com.netflix.archaius:archaius-core:0.5.6" compile "com.netflix.servo:servo-core:0.5.5" compile 'com.netflix.eureka:eureka-client:1.1.110' diff --git a/dyno-queues-redis/src/main/java/com/netflix/dyno/queues/redis/RedisDynoQueue.java b/dyno-queues-redis/src/main/java/com/netflix/dyno/queues/redis/RedisDynoQueue.java index 78dcc97..504d4b9 100644 --- a/dyno-queues-redis/src/main/java/com/netflix/dyno/queues/redis/RedisDynoQueue.java +++ b/dyno-queues-redis/src/main/java/com/netflix/dyno/queues/redis/RedisDynoQueue.java @@ -47,6 +47,7 @@ import redis.clients.jedis.JedisCommands; import redis.clients.jedis.Tuple; +import redis.clients.jedis.params.sortedset.ZAddParams; /** * @@ -284,10 +285,10 @@ private List _pop(Set ids, int messageCount) throws Exception { String unackQueueName = getUnackKey(queueName, shardName); List popped = new LinkedList<>(); - + ZAddParams zParams = ZAddParams.zAddParams().nx(); for (String msgId : ids) { - - long added = quorumConn.zadd(unackQueueName, unackScore, msgId); + + long added = quorumConn.zadd(unackQueueName, unackScore, msgId, zParams); if(added == 0){ if (logger.isDebugEnabled()) { logger.debug("cannot add to the unack shard " + msgId); diff --git a/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/DynoShardSupplierTest.java b/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/DynoShardSupplierTest.java index b4b0946..71f79a0 100644 --- a/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/DynoShardSupplierTest.java +++ b/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/DynoShardSupplierTest.java @@ -46,9 +46,9 @@ public void test(){ @Override public Collection getHosts() { List hosts = new LinkedList<>(); - hosts.add(new Host("host1", 8102, Status.Up).setRack("us-east-1a")); - hosts.add(new Host("host2", 8102, Status.Up).setRack("us-east-1b")); - hosts.add(new Host("host3", 8102, Status.Up).setRack("us-east-1d")); + hosts.add(new Host("host1", 8102, "us-east-1a", Status.Up)); + hosts.add(new Host("host2", 8102, "us-east-1b", Status.Up)); + hosts.add(new Host("host3", 8102, "us-east-1d", Status.Up)); return hosts; } }; diff --git a/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/RedisDynoQueueTest.java b/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/RedisDynoQueueTest.java index afd9e01..d92e5bc 100644 --- a/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/RedisDynoQueueTest.java +++ b/dyno-queues-redis/src/test/java/com/netflix/dyno/queues/redis/RedisDynoQueueTest.java @@ -65,7 +65,7 @@ public static void setUpBeforeClass() throws Exception { @Override public Collection getHosts() { List hosts = new LinkedList<>(); - hosts.add(new Host("ec2-11-22-33-444.compute-0.amazonaws.com", 8102, Status.Up).setRack("us-east-1d")); + hosts.add(new Host("ec2-11-22-33-444.compute-0.amazonaws.com", 8102, "us-east-1d", Status.Up)); return hosts; } };