Package io.lettuce.core.output
Class PushOutput<K,V>
- java.lang.Object
-
- io.lettuce.core.output.CommandOutput<K,V,List<Object>>
-
- io.lettuce.core.output.NestedMultiOutput<K,V>
-
- io.lettuce.core.output.PushOutput<K,V>
-
- All Implemented Interfaces:
PushMessage
public class PushOutput<K,V> extends NestedMultiOutput<K,V> implements PushMessage
Output for push notifications. The response output is alwaysList<Object>
as push notifications may contain arbitrary values. The first response element which denotes the push message type is available throughtype()
.- Since:
- 6.0
- Author:
- Mark Paluch
-
-
Field Summary
-
Fields inherited from class io.lettuce.core.output.CommandOutput
codec, error, output
-
-
Constructor Summary
Constructors Constructor Description PushOutput(RedisCodec<K,V> codec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Object>
getContent()
Returns the notification message contents.List<Object>
getContent(Function<ByteBuffer,Object> decodeFunction)
Returns the notification message contents by applying adecodeFunction
onByteBuffer
elements.String
getType()
void
set(ByteBuffer bytes)
Update the command output with a sequence of bytes, ornull
.void
setSingle(ByteBuffer bytes)
Update the command output with a sequence of bytes, ornull
representing a simple string.String
type()
-
Methods inherited from class io.lettuce.core.output.NestedMultiOutput
complete, multi, set, set
-
Methods inherited from class io.lettuce.core.output.CommandOutput
decodeAscii, get, getError, hasError, multiArray, multiMap, multiPush, multiSet, set, setBigNumber, setError, setError, toString
-
-
-
-
Constructor Detail
-
PushOutput
public PushOutput(RedisCodec<K,V> codec)
-
-
Method Detail
-
set
public void set(ByteBuffer bytes)
Description copied from class:CommandOutput
Update the command output with a sequence of bytes, ornull
. ConcreteCommandOutput
implementations must override this method to decodebulk
/bytes response values.- Overrides:
set
in classNestedMultiOutput<K,V>
- Parameters:
bytes
- The command output, or null.
-
setSingle
public void setSingle(ByteBuffer bytes)
Description copied from class:CommandOutput
Update the command output with a sequence of bytes, ornull
representing a simple string. ConcreteCommandOutput
implementations must override this method to decodesingle
/bytes response values.- Overrides:
setSingle
in classNestedMultiOutput<K,V>
- Parameters:
bytes
- The command output, or null.
-
type
public String type()
-
getType
public String getType()
- Specified by:
getType
in interfacePushMessage
- Returns:
- the push message type.
-
getContent
public List<Object> getContent()
Description copied from interface:PushMessage
Returns the notification message contents. The content contains all response value beginning withPushMessage.getType()
using their appropriate Java representation. String data (simple and bulk) are represented asByteBuffer
and can be decoded throughStringCodec.decodeValue(ByteBuffer)
.ByteBuffer
objects are read-only buffers that share the content without sharing the read-position.- Specified by:
getContent
in interfacePushMessage
- Returns:
- the notification message containing all response values including
PushMessage.getType()
.
-
getContent
public List<Object> getContent(Function<ByteBuffer,Object> decodeFunction)
Description copied from interface:PushMessage
Returns the notification message contents by applying adecodeFunction
onByteBuffer
elements. The content contains all response value beginning withPushMessage.getType()
using their appropriate Java representation. String data (simple and bulk) are mapped usingdecodeFunction
. Please note that buffer read positions are tracked by this method so decode functions are not required to reset the position.- Specified by:
getContent
in interfacePushMessage
- Returns:
- the notification message containing all response values including
PushMessage.getType()
.
-
-