-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33703 from cescoffier/allow-redis-pub-sub-to-rece…
…ive-channel Allows receiving the channel name when using Redis Pub/Sub
- Loading branch information
Showing
7 changed files
with
516 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...s-client/runtime/src/main/java/io/quarkus/redis/datasource/pubsub/RedisPubSubMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.redis.datasource.pubsub; | ||
|
||
/** | ||
* A structure encapsulating the Redis pub/sub payload and the channel on which the message was sent. | ||
* This structure is used when using {@link ReactivePubSubCommands#subscribeAsMessages(String...)} and | ||
* {@link ReactivePubSubCommands#subscribeAsMessagesToPatterns(String...)} | ||
* | ||
* @param <V> the type of payload | ||
*/ | ||
public interface RedisPubSubMessage<V> { | ||
|
||
/** | ||
* @return the payload. | ||
*/ | ||
V getPayload(); | ||
|
||
/** | ||
* @return the channel on which the message was sent. | ||
*/ | ||
String getChannel(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../runtime/src/main/java/io/quarkus/redis/runtime/datasource/DefaultRedisPubSubMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.quarkus.redis.runtime.datasource; | ||
|
||
import io.quarkus.redis.datasource.pubsub.RedisPubSubMessage; | ||
|
||
public class DefaultRedisPubSubMessage<V> implements RedisPubSubMessage<V> { | ||
|
||
private final V payload; | ||
private final String channel; | ||
|
||
public DefaultRedisPubSubMessage(V payload, String channel) { | ||
this.payload = payload; | ||
this.channel = channel; | ||
} | ||
|
||
@Override | ||
public V getPayload() { | ||
return payload; | ||
} | ||
|
||
@Override | ||
public String getChannel() { | ||
return channel; | ||
} | ||
} |
Oops, something went wrong.