File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments