Class BlockingPubSubCommandsImpl<V>
java.lang.Object
io.quarkus.redis.runtime.datasource.AbstractRedisCommandGroup
io.quarkus.redis.runtime.datasource.BlockingPubSubCommandsImpl<V>
- All Implemented Interfaces:
PubSubCommands<V>
,RedisCommands
public class BlockingPubSubCommandsImpl<V>
extends AbstractRedisCommandGroup
implements PubSubCommands<V>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.quarkus.redis.datasource.pubsub.PubSubCommands
PubSubCommands.RedisSubscriber
-
Field Summary
Fields inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommandGroup
ds, timeout
-
Constructor Summary
ConstructorDescriptionBlockingPubSubCommandsImpl
(RedisDataSource ds, ReactivePubSubCommands<V> reactive, Duration timeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Publishes a message to a given channelSubscribes to a given channel.Subscribes to a given channel.subscribe
(List<String> channels, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Same asPubSubCommands.subscribe(List, Consumer, Runnable, Consumer)
but also receives the channel name.Subscribes to the given channels.subscribe
(List<String> channels, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Subscribes to the given channels.subscribeToPattern
(String pattern, BiConsumer<String, V> onMessage) Same asPubSubCommands.subscribeToPattern(String, Consumer)
, but instead of receiving only the message payload, it also receives the name of the channel.subscribeToPattern
(String pattern, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Same asPubSubCommands.subscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receives the channel name.subscribeToPattern
(String pattern, Consumer<V> onMessage) Subscribes to a given pattern likechan*l
.subscribeToPattern
(String pattern, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Subscribes to a given pattern likechan*l
.subscribeToPatterns
(List<String> patterns, BiConsumer<String, V> onMessage) Same asPubSubCommands.subscribeToPatterns(List, Consumer)
, but instead of only receiving the payload, it also receives the channel name.subscribeToPatterns
(List<String> patterns, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Same asPubSubCommands.subscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receive the channel name.subscribeToPatterns
(List<String> patterns, Consumer<V> onMessage) Subscribes to the given patterns likechan*l
.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.AbstractRedisCommandGroup
getDataSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.quarkus.redis.datasource.RedisCommands
getDataSource
-
Constructor Details
-
BlockingPubSubCommandsImpl
public BlockingPubSubCommandsImpl(RedisDataSource ds, ReactivePubSubCommands<V> reactive, Duration timeout)
-
-
Method Details
-
publish
Description copied from interface:PubSubCommands
Publishes a message to a given channel- Specified by:
publish
in interfacePubSubCommands<V>
- Parameters:
channel
- the channelmessage
- the message
-
subscribe
Description copied from interface:PubSubCommands
Subscribes to a given channel.- Specified by:
subscribe
in interfacePubSubCommands<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
Description copied from interface:PubSubCommands
Subscribes to a given pattern likechan*l
.- Specified by:
subscribeToPattern
in interfacePubSubCommands<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 PubSubCommands.RedisSubscriber subscribeToPatterns(List<String> patterns, Consumer<V> onMessage) Description copied from interface:PubSubCommands
Subscribes to the given patterns likechan*l
.- Specified by:
subscribeToPatterns
in interfacePubSubCommands<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
Description copied from interface:PubSubCommands
Subscribes to the given channels.- Specified by:
subscribe
in interfacePubSubCommands<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 PubSubCommands.RedisSubscriber subscribe(String channel, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Subscribes to a given channel.- Specified by:
subscribe
in interfacePubSubCommands<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 PubSubCommands.RedisSubscriber subscribeToPattern(String pattern, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Subscribes to a given pattern likechan*l
.- Specified by:
subscribeToPattern
in interfacePubSubCommands<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 PubSubCommands.RedisSubscriber subscribeToPatterns(List<String> patterns, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Subscribes to the given patterns likechan*l
.- Specified by:
subscribeToPatterns
in interfacePubSubCommands<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 PubSubCommands.RedisSubscriber subscribe(List<String> channels, Consumer<V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Subscribes to the given channels.- Specified by:
subscribe
in interfacePubSubCommands<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
-
subscribeToPattern
public PubSubCommands.RedisSubscriber subscribeToPattern(String pattern, BiConsumer<String, V> onMessage) Description copied from interface:PubSubCommands
Same asPubSubCommands.subscribeToPattern(String, Consumer)
, but instead of receiving only the message payload, it also receives the name of the channel.- Specified by:
subscribeToPattern
in interfacePubSubCommands<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. The first parameter is the name of the channel. The second parameter is the payload.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPatterns
public PubSubCommands.RedisSubscriber subscribeToPatterns(List<String> patterns, BiConsumer<String, V> onMessage) Description copied from interface:PubSubCommands
Same asPubSubCommands.subscribeToPatterns(List, Consumer)
, but instead of only receiving the payload, it also receives the channel name.- Specified by:
subscribeToPatterns
in interfacePubSubCommands<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. The first parameter is the channel name. The second one if the payload.- Returns:
- the subscriber object that lets you unsubscribe
-
subscribeToPattern
public PubSubCommands.RedisSubscriber subscribeToPattern(String pattern, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Same asPubSubCommands.subscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receives the channel name.- Specified by:
subscribeToPattern
in interfacePubSubCommands<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. 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
public PubSubCommands.RedisSubscriber subscribeToPatterns(List<String> patterns, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Same asPubSubCommands.subscribeToPatterns(List, Consumer, Runnable, Consumer)
, but also receive the channel name.- Specified by:
subscribeToPatterns
in interfacePubSubCommands<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. 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
public PubSubCommands.RedisSubscriber subscribe(List<String> channels, BiConsumer<String, V> onMessage, Runnable onEnd, Consumer<Throwable> onException) Description copied from interface:PubSubCommands
Same asPubSubCommands.subscribe(List, Consumer, Runnable, Consumer)
but also receives the channel name.- Specified by:
subscribe
in interfacePubSubCommands<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. 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
-