Class ReactiveRedisStreamMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractReactiveMessageHandler
org.springframework.integration.redis.outbound.ReactiveRedisStreamMessageHandler
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Ordered
,ExpressionCapable
,Orderable
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,TrackableComponent
,ReactiveMessageHandler
Implementation of
ReactiveMessageHandler
which writes
Message payload or Message itself (see extractPayload
) into a Redis stream using Reactive Stream operations.- Since:
- 5.4
- Author:
- Attoumane Ahamadi, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionReactiveRedisStreamMessageHandler
(ReactiveRedisConnectionFactory connectionFactory, String streamKey) Create an instance based on providedReactiveRedisConnectionFactory
and key for stream.ReactiveRedisStreamMessageHandler
(ReactiveRedisConnectionFactory connectionFactory, Expression streamKeyExpression) Create an instance based on providedReactiveRedisConnectionFactory
and expression for stream key. -
Method Summary
Modifier and TypeMethodDescriptionSubclasses may implement this method to provide component type information.protected reactor.core.publisher.Mono<Void>
handleMessageInternal
(Message<?> message) protected void
onInit()
Subclasses may implement this for initialization logic.void
setExtractPayload
(boolean extractPayload) Set totrue
to extract the payload; otherwise the entire message is sent.void
setHashMapper
(HashMapper<String, ?, ?> hashMapper) (Optional) Set theHashMapper
used to createreactiveStreamOperations
.void
setSerializationContext
(RedisSerializationContext<String, ?> serializationContext) Methods inherited from class org.springframework.integration.handler.AbstractReactiveMessageHandler
handleMessage
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
ReactiveRedisStreamMessageHandler
public ReactiveRedisStreamMessageHandler(ReactiveRedisConnectionFactory connectionFactory, String streamKey) Create an instance based on providedReactiveRedisConnectionFactory
and key for stream.- Parameters:
connectionFactory
- theReactiveRedisConnectionFactory
to usestreamKey
- the key for stream
-
ReactiveRedisStreamMessageHandler
public ReactiveRedisStreamMessageHandler(ReactiveRedisConnectionFactory connectionFactory, Expression streamKeyExpression) Create an instance based on providedReactiveRedisConnectionFactory
and expression for stream key.- Parameters:
connectionFactory
- theReactiveRedisConnectionFactory
to usestreamKeyExpression
- the SpEL expression to evaluate a key for stream
-
-
Method Details
-
setSerializationContext
-
setHashMapper
(Optional) Set theHashMapper
used to createreactiveStreamOperations
. The defaultHashMapper
is defined from the providedRedisSerializationContext
- Parameters:
hashMapper
- the wanted hashMapper
-
setExtractPayload
public void setExtractPayload(boolean extractPayload) Set totrue
to extract the payload; otherwise the entire message is sent. Defaulttrue
.- Parameters:
extractPayload
- false to not extract.
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classMessageHandlerSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classIntegrationObjectSupport
-
handleMessageInternal
- Specified by:
handleMessageInternal
in classAbstractReactiveMessageHandler
-