Class StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V extends Record<K,?>>
java.lang.Object
org.springframework.data.redis.stream.StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V>
- Type Parameters:
K
- Stream key and Stream field typeV
- Stream value type
- Enclosing interface:
- StreamMessageListenerContainer<K,
V extends Record<K, ?>>
-
Method Summary
Modifier and TypeMethodDescriptionbatchSize
(int messagesPerPoll) Configure a batch size for theCOUNT
option during reading.build()
errorHandler
(ErrorHandler errorHandler) Configure aErrorHandler
to be notified onerrors
.<HK,
HV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K, MapRecord<K, HK, HV>> hashKeySerializer
(RedisSerializer<HK> serializer) Configure a hash key serializer.<HK,
HV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K, MapRecord<K, HK, HV>> hashValueSerializer
(RedisSerializer<HV> serializer) Configure a hash value serializer.<NK,
NV extends Record<NK, ?>>
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<NK,NV> keySerializer
(RedisSerializer<NK> serializer) Configure a key serializer.<NV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,
ObjectRecord<K, NV>> objectMapper
(HashMapper<NV, ?, ?> hashMapper) Configure a hash mapper.pollTimeout
(Duration pollTimeout) Configure a poll timeout for theBLOCK
option during reading.serializer
(RedisSerializer<T> serializer) Configure a key, hash key and hash value serializer.<NV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,
ObjectRecord<K, NV>> targetType
(Class<NV> targetType) Configure a hash target type.
-
Method Details
-
pollTimeout
public StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V> pollTimeout(Duration pollTimeout) Configure a poll timeout for theBLOCK
option during reading.- Parameters:
pollTimeout
- must not be null or negative.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
batchSize
public StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V> batchSize(int messagesPerPoll) Configure a batch size for theCOUNT
option during reading.- Parameters:
messagesPerPoll
- must not be greater zero.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
executor
public StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V> executor(Executor executor) - Parameters:
executor
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
errorHandler
public StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,V> errorHandler(ErrorHandler errorHandler) Configure aErrorHandler
to be notified onerrors
.- Parameters:
errorHandler
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
serializer
public <T> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<T,MapRecord<T, serializerT, T>> (RedisSerializer<T> serializer) Configure a key, hash key and hash value serializer.- Parameters:
serializer
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
keySerializer
public <NK,NV extends Record<NK, StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<NK,?>> NV> keySerializer(RedisSerializer<NK> serializer) Configure a key serializer.- Parameters:
serializer
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
hashKeySerializer
public <HK,HV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,MapRecord<K, hashKeySerializerHK, HV>> (RedisSerializer<HK> serializer) Configure a hash key serializer.- Parameters:
serializer
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
hashValueSerializer
public <HK,HV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,MapRecord<K, hashValueSerializerHK, HV>> (RedisSerializer<HV> serializer) Configure a hash value serializer.- Parameters:
serializer
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
targetType
public <NV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,ObjectRecord<K, targetTypeNV>> (Class<NV> targetType) Configure a hash target type. Changes the emittedRecord
type toObjectRecord
.- Parameters:
targetType
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
objectMapper
public <NV> StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder<K,ObjectRecord<K, objectMapperNV>> (HashMapper<NV, ?, ?> hashMapper) Configure a hash mapper. Changes the emittedRecord
type toObjectRecord
.- Parameters:
hashMapper
- must not be null.- Returns:
this
StreamMessageListenerContainer.StreamMessageListenerContainerOptionsBuilder
.
-
build
-