Interface ReactivePubSubCommands<V>
-
- All Superinterfaces:
ReactiveRedisCommands
- All Known Implementing Classes:
ReactivePubSubCommandsImpl
public interface ReactivePubSubCommands<V> extends ReactiveRedisCommands
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ReactivePubSubCommands.ReactiveRedisSubscriber
A redis subscriber
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description io.smallrye.mutiny.Uni<Void>
publish(String channel, V message)
Publishes a message to a given channelio.smallrye.mutiny.Multi<V>
subscribe(String... channels)
Subscribes to the given channels.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(String channel, Consumer<V> onMessage)
Subscribes to a given channel.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(String channel, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to a given channel.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(List<String> channels, BiConsumer<String,V> onMessage)
Same assubscribe(List, Consumer)
, but instead of just receiving the payload, it also receives the channel name.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(List<String> channels, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribe(List, Consumer, Runnable, Consumer)
but also receives the channel name.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(List<String> channels, Consumer<V> onMessage)
Subscribes to the given channels.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribe(List<String> channels, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to the given channels.io.smallrye.mutiny.Multi<RedisPubSubMessage<V>>
subscribeAsMessages(String... channels)
Same assubscribe(String...)
, but instead of receiving the message payload directly, it receives instances ofRedisPubSubMessage
wrapping the payload and the channel on which the message has been sent.io.smallrye.mutiny.Multi<RedisPubSubMessage<V>>
subscribeAsMessagesToPatterns(String... patterns)
Same assubscribeToPatterns(String...)
, but instead of receiving only the message payload, it receives instances ofRedisPubSubMessage
containing both the payload and the name of the channel.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPattern(String pattern, BiConsumer<String,V> onMessage)
Same assubscribeToPattern(String, Consumer)
, but instead of receiving only the message payload, it also receives the name of the channel.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPattern(String pattern, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receives the channel name.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPattern(String pattern, Consumer<V> onMessage)
Subscribes to a given pattern likechan*l
.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPattern(String pattern, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to a given pattern likechan*l
.io.smallrye.mutiny.Multi<V>
subscribeToPatterns(String... patterns)
Subscribes to the given patterns.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPatterns(List<String> patterns, BiConsumer<String,V> onMessage)
Same assubscribeToPatterns(List, Consumer)
, but instead of only receiving the payload, it also receives the channel name.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPatterns(List<String> patterns, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receive the channel name.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPatterns(List<String> patterns, Consumer<V> onMessage)
Subscribes to the given patterns likechan*l
.io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber>
subscribeToPatterns(List<String> patterns, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to the given patterns likechan*l
.-
Methods inherited from interface io.quarkus.redis.datasource.ReactiveRedisCommands
getDataSource
-
-
-
-
Method Detail
-
publish
io.smallrye.mutiny.Uni<Void> publish(String channel, V message)
Publishes a message to a given channel- Parameters:
channel
- the channelmessage
- the message- Returns:
- a Uni producing a
null
item once the message is sent, a failure otherwise.
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(String channel, Consumer<V> onMessage)
Subscribes to a given channel.- Parameters:
channel
- the channelonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channel, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPattern
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, Consumer<V> onMessage)
Subscribes to a given pattern likechan*l
.- Parameters:
pattern
- the patternonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPattern
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, BiConsumer<String,V> onMessage)
Same assubscribeToPattern(String, Consumer)
, but instead of receiving only the message payload, it also receives the name of the channel.- Parameters:
pattern
- the patternonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the name of the channel. The second parameter is the payload.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPatterns
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, Consumer<V> onMessage)
Subscribes to the given patterns likechan*l
.- Parameters:
patterns
- the patternsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPatterns
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, BiConsumer<String,V> onMessage)
Same assubscribeToPatterns(List, Consumer)
, but instead of only receiving the payload, it also receives the channel name.- Parameters:
patterns
- the patternsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the channel name. The second one if the payload.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, Consumer<V> onMessage)
Subscribes to the given channels.- Parameters:
channels
- the channelsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channels, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, BiConsumer<String,V> onMessage)
Same assubscribe(List, Consumer)
, but instead of just receiving the payload, it also receives the channel name.- Parameters:
channels
- the channelsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channels, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the channel name. The second one if the payload.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(String channel, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to a given channel.- Parameters:
channel
- the channelonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channel, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPattern
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to a given pattern likechan*l
.- Parameters:
pattern
- the patternonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPattern
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receives the channel name.- Parameters:
pattern
- the patternonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the name of the channel. The second parameter is the payload.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPatterns
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to the given patterns likechan*l
.- Parameters:
patterns
- the patternsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPatterns
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receive the channel name.- Parameters:
patterns
- the patternsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the name of the channel. The second parameter is the payload.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Subscribes to the given channels.- Parameters:
channels
- the channelsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channels, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, BiConsumer<String,V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Same assubscribe(List, Consumer, Runnable, Consumer)
but also receives the channel name.- Parameters:
channels
- the channelsonMessage
- the message consumer. Be aware that this callback is invoked for each message sent to the given channels, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed. The first parameter is the name of the channel. The second parameter is the payload.onEnd
- the end handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.onException
- the exception handler. Be aware that this callback is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribe
io.smallrye.mutiny.Multi<V> subscribe(String... channels)
Subscribes to the given channels. This method returns aMulti
emitting an item of typeV
for each received message. This emission happens on the I/O thread, so you must not block. UseemitOn
to offload the processing to another thread.- Parameters:
channels
- the channels- Returns:
- the stream of message
-
subscribeAsMessages
io.smallrye.mutiny.Multi<RedisPubSubMessage<V>> subscribeAsMessages(String... channels)
Same assubscribe(String...)
, but instead of receiving the message payload directly, it receives instances ofRedisPubSubMessage
wrapping the payload and the channel on which the message has been sent.- Parameters:
channels
- the channels- Returns:
- the stream of message
-
subscribeToPatterns
io.smallrye.mutiny.Multi<V> subscribeToPatterns(String... patterns)
Subscribes to the given patterns. This method returns aMulti
emitting an item of typeV
for each received message. This emission happens on the I/O thread, so you must not block. UseemitOn
to offload the processing to another thread.- Parameters:
patterns
- the patterns- Returns:
- the stream of message
-
subscribeAsMessagesToPatterns
io.smallrye.mutiny.Multi<RedisPubSubMessage<V>> subscribeAsMessagesToPatterns(String... patterns)
Same assubscribeToPatterns(String...)
, but instead of receiving only the message payload, it receives instances ofRedisPubSubMessage
containing both the payload and the name of the channel.- Parameters:
patterns
- the patterns- Returns:
- the stream of message
-
-