File tree 2 files changed +16
-5
lines changed
2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ RQ (Redis Queue) is a simple Clojure package for queueing jobs and processing th
9
9
We distribute the library via [ Clojars] ( https://clojars.org/com.moclojer/rq ) .
10
10
11
11
``` edn
12
- com.moclojer/rq {:mvn/version " 0.1.2 " }
12
+ com.moclojer/rq {:mvn/version " 0.1.3 " }
13
13
```
14
14
15
15
``` clojure
16
- [com.moclojer/rq " 0.1.2 " ]
16
+ [com.moclojer/rq " 0.1.3 " ]
17
17
```
18
18
19
19
## example
@@ -33,8 +33,19 @@ com.moclojer/rq {:mvn/version "0.1.2"}
33
33
(prn :popped (queue/pop! *redis-pool* " my-queue" ))
34
34
35
35
; ; pub/sub
36
- (pubsub/subscribe! *redis-pool* #(prn :chan %1 :msg %2 ) [" name-subs" ])
37
- (pubsub/publish! *redis-pool* " name-subs" {:hello true )})
36
+ (def my-workers
37
+ [{:channel " my-channel"
38
+ :handler (fn [msg]
39
+ (prn :msg :my-channel msg))}
40
+ {:channel " my-other-channel"
41
+ :handler (fn [{:keys [my data hello]}]
42
+ (my-function my data hello))}])
43
+
44
+ (pubsub/subscribe! *redis-pool* my-workers)
45
+ (pubsub/publish! *redis-pool* " my-channel" " hello world" )
46
+ (pubsub/publish! *redis-pool* " my-other-channel" {:my " moclojer team"
47
+ :data " app.moclojer.com"
48
+ :hello " maybe you'll like this website" })
38
49
39
50
(rq/close-client *redis-pool*)
40
51
```
Original file line number Diff line number Diff line change 2
2
(:import
3
3
[redis.clients.jedis JedisPooled]))
4
4
5
- (def version " 0.1.2 " )
5
+ (def version " 0.1.3 " )
6
6
7
7
; ; redis connection pool to be thread safe
8
8
(def
You can’t perform that action at this time.
0 commit comments