Skip to content
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

Registration of push message listeners #1284

Closed
mp911de opened this issue May 5, 2020 · 0 comments
Closed

Registration of push message listeners #1284

mp911de opened this issue May 5, 2020 · 0 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@mp911de
Copy link
Collaborator

mp911de commented May 5, 2020

We should allow registration of push message listeners given that Redis 6 (RESP3) features push messages. In RESP3 mode, a connection does not require an active subscription to receive push notifications, instead, Redis sends messages starting with > where the first item is a String. The rest of the message remains dynamic.

It would make sense to provide a generic callback such as RedisPushListener with a onPush(String type, Object args) signature. Examples for push messages are:

Pub/Sub Channel Subscription:

>3
$7
message
$5
hello
$5
world

Client-side Caching:

>3
>2
$10
invalidate
*1
$3
key

Typically, the second argument (Object) would be either a List<Object> containing the all arguments from position 2 or be only the second argument.

Since we don't have any relation to keys and values, we need to define which part of a RedisCodec we would have to use.

Push message listeners would be registered directly on StatefulConnection. For Redis Cluster, we could add an extension similar to RedisClusterPubSubListener that defines the cluster node from which the event originated.

@mp911de mp911de added the type: enhancement A general enhancement label May 5, 2020
@mp911de mp911de added this to the 6.0 RC1 milestone May 5, 2020
mp911de added a commit that referenced this issue Jun 19, 2020
We now support registration of push message listeners through StatefulRedisConnection and StatefulRedisClusterConnection. PushListener are notified upon receiving push messages through RESP3.

StatefulRedisConnection connection = …;
conn.addListener(pushMessage -> …);
@mp911de mp911de closed this as completed Jun 19, 2020
mp911de added a commit that referenced this issue Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant