https://github.com/aravindbaskaran/redis-pubsub
A redis pubsub client with keep-alive heart beats on top of the awesome com.taoensso/carmine library
https://github.com/aravindbaskaran/redis-pubsub
clojure pubsub redis
Last synced: 10 months ago
JSON representation
A redis pubsub client with keep-alive heart beats on top of the awesome com.taoensso/carmine library
- Host: GitHub
- URL: https://github.com/aravindbaskaran/redis-pubsub
- Owner: aravindbaskaran
- License: epl-1.0
- Created: 2018-05-05T07:35:49.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-05T08:49:47.000Z (about 8 years ago)
- Last Synced: 2025-08-02T22:16:48.667Z (11 months ago)
- Topics: clojure, pubsub, redis
- Language: Clojure
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
```clojure
[com.aravindbaskaran/redis-pubsub "0.1.1"] ; See CHANGELOG for details
```
[](https://clojars.org/com.aravindbaskaran/redis-pubsub)
# redis-pubsub
A redis pubsub client with keep-alive heart beats on top of the awesome com.taoensso/carmine library.
The main purpose of this library is to address the dead connections on redis pubsub clients with no way to re-subscribe or keep alive.
Related GH Issue - https://github.com/ptaoussanis/carmine/issues/15
Existing PR - https://github.com/ptaoussanis/carmine/pull/207
So until this gets merged into the main carmine library in some format, the world keeps spinning and the connections keep dying, this library has use.
## Features
* Keeps pubsub clients **ALIVE** :)
* Very tiny Clojure library
* **Documented**, base macros and direct subscribe API with support for Redis 3.2+
* **Tested** for connection failures because of socket read timeout, hard disconnects and stale/old connects
* **Awesome underlying All-Clojure redis library** in com.taoensso/carmine redis client
## Usage
### with-new-keepalive-pubsub-listener macro
```clojure
(require '[redis-pubsub.core :as pubsub])
(require '[taoensso.carmine :as car])
(pubsub/with-new-keepalive-pubsub-listener {}
{
"ps-foo" #(println %) ;handle channel ps-foo, arguments passed ["message" channel-name message-string]
"ps-baz" #(println %) ;handle channel ps-baz, arguments passed ["message" channel-name message-string]
"pubsub:ping" #(println %) ;callback on ping, arguments passed ["pong" "pubsub:ping"]
"pubsub:listener:fail" #(println %) ;callback on listener failures, arguments passed ["pubsub:error" "pubsub:listener:fail" exception-obj]
}
; subsrcibe to required channels
(car/subscribe "ps-foo" "ps-baz"))
```
### subscribe API
```clojure
(require '[redis-pubsub.core :as pubsub])
(pubsub/subscribe
{}
"ps-foo"
#(println %) ;handle channel ps-foo, arguments passed ["message" channel-name message-string]
)
```
Broader documentation of underlying carmine interfaces
## License
Distributed under the [EPL v1.0] \(same as Clojure).
Copyright © 2018- [Aravind Baskaran].
[EPL v1.0]: https://raw.githubusercontent.com/ptaoussanis/carmine/master/LICENSE
[Aravind Baskaran]: https://github.com/aravindbaskaran/