Skip to content

Commit 28af388

Browse files
committed
redis readme
1 parent e8155ed commit 28af388

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

cockroach-queue-redis/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# cockroach-queue-redis
2+
3+
使用 redis 作为消息队列,使用方法为:
4+
5+
```java
6+
@EnableAutoConfiguration
7+
@AppName("redis")
8+
@ThreadConfig(num = 5, sleep = 100)
9+
@AutoClose(false)
10+
@Store(DescribeStore.class)
11+
public class RedisTaskQueueTest {
12+
private static CockroachQueue queue = RedisTaskQueue.of("172.30.154.75", 6379, "cockroach");
13+
14+
public static void main(String[] args) throws Exception {
15+
CockroachApplication.run(RedisTaskQueueTest.class,queue);
16+
}
17+
18+
@Test
19+
public void push() throws Exception {
20+
queue.filter(new IQueueTaskFilter() {
21+
@Override
22+
public boolean accept(Task task) {
23+
return task.getUrl().contains("zhangyingwei");
24+
}
25+
});
26+
for (int i = 0; i < 100; i++) {
27+
Task task = new Task("http://blog.zhangyingwei.com","zhangyingwei").retry(10).addDeep(20);
28+
queue.push(task);
29+
}
30+
queue.push(new Task("http://baidu.com"));
31+
}
32+
}
33+
34+
```

0 commit comments

Comments
 (0)