-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API - PUBSUB CHANNELS #425
Comments
Garnet supports pub/sub already. If you search online for examples of pub/sub in Redis, there should be a lot of hits. Let us know if you run into any bugs or issues. |
@badrishc
and
|
Running GarnetServer from the main branch (with the new --lua option set), the first example in the Celery documentation fails. To reproduce the error you will need Python and Celery. Install it with: pip install celery[redis] Create the file tasks.py: from celery import Celery
app = Celery('tasks', backend='redis://localhost', broker='redis://localhost:6379/0')
@app.task
def add(x, y):
return x + y In the directory where the file is saved open a terminal and execute:
In the same directory start a new terminal, execute python.exe and enter the following: > from tasks import add
> add.delay(4,4) In the first terminal you will get an exception from the Python Redis client:
|
Using Carmine, a Redis client for Clojure that auto-generates Clojure functions from the official Redis command spec, the following example causes GarnetServer to terminate: (ns my-app (:require [taoensso.carmine :as car]))
(defonce my-conn-pool (car/connection-pool {}))
(def my-conn-spec {:uri "redis://localhost/"})
(def my-conn-opts {:pool my-conn-pool, :spec my-conn-spec})
(defmacro wcar* [& body] `(car/wcar my-conn-opts ~@body))
(def my-listener
(car/with-new-pubsub-listener (:spec my-conn-spec)
{"channel*" (fn f2 [msg] (println "f2:" msg))}
(car/psubscribe "channel*")))
(car/with-open-listener my-listener
(car/unsubscribe)) This is the command line output of GarnetServer:
|
I cannot get carmine to work on WSL, but try commenting out the debug assert on that line (C:\Users\mardu\git\garnet\libs\server\Resp\PubSubCommands.cs:line 262) |
That works! Actually, I tried out Carmine on Windows. I installed Clojure using the Windows installer. Then I created the file {:deps
{com.taoensso/carmine {:mvn/version "3.4.1"}}
} And then I started the Clojure REPL (clj.exe) on the same directory. I also used the VS Code Extension Calva to execute code directly in the REPL. |
Got it, will try this later. Thanks! |
* Fix AOF fast-forward during main memory replication * noFlush should not wait on FlushEvent * fix the fix * update version for release * nit * NetworkClusterAppendLog shouldnt write a response * Fix the flush behavior for safe tail refresh. * clean up exception handling * Unrelated fix to pub-sub - see issue #425. * fix non-MMR skipping logic for space at the end of a page * fix comparison --------- Co-authored-by: Vasileios Zois <[email protected]>
@gogo1008 Do you the underneath redis command? Is it PUBSUB CHANNELS? |
@gogo1008 Looks like it uses a Redis Stream XADD command, not PUB/SUB. Can you open a separate issue to track it? |
Feature request type
sample request
Is your feature request related to a problem? Please describe
Often used
Describe the solution you'd like
Often used
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: