Class ReactivePubSubCommandsImpl<V>
- java.lang.Object
-
- io.quarkus.redis.runtime.datasource.AbstractRedisCommands
-
- io.quarkus.redis.runtime.datasource.ReactivePubSubCommandsImpl<V>
-
- All Implemented Interfaces:
ReactivePubSubCommands<V>
,ReactiveRedisCommands
public class ReactivePubSubCommandsImpl<V> extends AbstractRedisCommands implements ReactivePubSubCommands<V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.quarkus.redis.datasource.pubsub.ReactivePubSubCommands
ReactivePubSubCommands.ReactiveRedisSubscriber
-
-
Field Summary
-
Fields inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
marshaller, redis
-
-
Constructor Summary
Constructors Constructor Description ReactivePubSubCommandsImpl(ReactiveRedisDataSourceImpl ds, Class<V> classOfMessage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReactiveRedisDataSource
getDataSource()
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, 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.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, 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 class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
execute
-
-
-
-
Constructor Detail
-
ReactivePubSubCommandsImpl
public ReactivePubSubCommandsImpl(ReactiveRedisDataSourceImpl ds, Class<V> classOfMessage)
-
-
Method Detail
-
getDataSource
public ReactiveRedisDataSource getDataSource()
- Specified by:
getDataSource
in interfaceReactiveRedisCommands
- Returns:
- the data source.
-
publish
public io.smallrye.mutiny.Uni<Void> publish(String channel, V message)
Description copied from interface:ReactivePubSubCommands
Publishes a message to a given channel- Specified by:
publish
in interfaceReactivePubSubCommands<V>
- Parameters:
channel
- the channelmessage
- the message- Returns:
- a Uni producing a
null
item once the message is sent, a failure otherwise.
-
subscribe
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(String channel, Consumer<V> onMessage)
Description copied from interface:ReactivePubSubCommands
Subscribes to a given channel.- Specified by:
subscribe
in interfaceReactivePubSubCommands<V>
- 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
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, Consumer<V> onMessage)
Description copied from interface:ReactivePubSubCommands
Subscribes to a given pattern likechan*l
.- Specified by:
subscribeToPattern
in interfaceReactivePubSubCommands<V>
- 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
-
subscribeToPatterns
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, Consumer<V> onMessage)
Description copied from interface:ReactivePubSubCommands
Subscribes to the given patterns likechan*l
.- Specified by:
subscribeToPatterns
in interfaceReactivePubSubCommands<V>
- 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
-
subscribe
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, Consumer<V> onMessage)
Description copied from interface:ReactivePubSubCommands
Subscribes to the given channels.- Specified by:
subscribe
in interfaceReactivePubSubCommands<V>
- 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
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(String channel, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Description copied from interface:ReactivePubSubCommands
Subscribes to a given channel.- Specified by:
subscribe
in interfaceReactivePubSubCommands<V>
- 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
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPattern(String pattern, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Description copied from interface:ReactivePubSubCommands
Subscribes to a given pattern likechan*l
.- Specified by:
subscribeToPattern
in interfaceReactivePubSubCommands<V>
- 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
-
subscribeToPatterns
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribeToPatterns(List<String> patterns, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Description copied from interface:ReactivePubSubCommands
Subscribes to the given patterns likechan*l
.- Specified by:
subscribeToPatterns
in interfaceReactivePubSubCommands<V>
- 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
-
subscribe
public io.smallrye.mutiny.Uni<ReactivePubSubCommands.ReactiveRedisSubscriber> subscribe(List<String> channels, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException)
Description copied from interface:ReactivePubSubCommands
Subscribes to the given channels.- Specified by:
subscribe
in interfaceReactivePubSubCommands<V>
- 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
public io.smallrye.mutiny.Multi<V> subscribe(String... channels)
Description copied from interface:ReactivePubSubCommands
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.- Specified by:
subscribe
in interfaceReactivePubSubCommands<V>
- Parameters:
channels
- the channels- Returns:
- the stream of message
-
subscribeToPatterns
public io.smallrye.mutiny.Multi<V> subscribeToPatterns(String... patterns)
Description copied from interface:ReactivePubSubCommands
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.- Specified by:
subscribeToPatterns
in interfaceReactivePubSubCommands<V>
- Parameters:
patterns
- the patterns- Returns:
- the stream of message
-
-