Skip to content

Commit e8155ed

Browse files
committed
添加了redis消息队列
1 parent c5bb4f2 commit e8155ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cockroach-queue-redis/src/main/java/com/zhangyingwei/cockroach/queue/RedisTaskQueue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public static RedisTaskQueue of(String host, Integer port,String key){
2727

2828
@Override
2929
public synchronized Task poll() throws Exception {
30-
String json = this.jedis.rpop(this.key);
30+
String json = this.jedis.lpop(this.key);
3131
JSONObject jsonObject = JSONObject.fromObject(json);
3232
return (Task) JSONObject.toBean(jsonObject, Task.class);
3333
}
3434

3535
@Override
3636
public synchronized Task take() throws Exception {
37-
List<String> json = this.jedis.brpop(Integer.MAX_VALUE,this.key);
37+
List<String> json = this.jedis.blpop(Integer.MAX_VALUE,this.key);
3838
JSONObject jsonObject = JSONObject.fromObject(json.get(1));
3939
return (Task) JSONObject.toBean(jsonObject, Task.class);
4040
}

0 commit comments

Comments
 (0)