Class ReactiveMessageHandlerAdapter
java.lang.Object
org.springframework.integration.handler.ReactiveMessageHandlerAdapter
- All Implemented Interfaces:
MessageHandler
A
MessageHandler
implementation to adapt a ReactiveMessageHandler
for synchronous invocations.
A subscription to the returned reactive type from ReactiveMessageHandler.handleMessage(Message)
call is done directly in the handleMessage(org.springframework.messaging.Message<?>)
implementation.
The framework wraps a target ReactiveMessageHandler
into this instance automatically
for XML and Annotation configuration. For Java DSL it is recommended to wrap for generic usage
(.handle(MessageHandle)
) or it has to be done in the
MessageHandlerSpec
implementation for protocol-specif ReactiveMessageHandler
.
The framework unwraps a delegate ReactiveMessageHandler
whenever it can compose
reactive streams, e.g. ReactiveStreamsConsumer
.
- Since:
- 5.3
- Author:
- Artem Bilan
- See Also:
-
Constructor Summary
ConstructorDescriptionReactiveMessageHandlerAdapter
(ReactiveMessageHandler reactiveMessageHandler) Instantiate based on the providedReactiveMessageHandler
. -
Method Summary
Modifier and TypeMethodDescriptionGet access to the delegateReactiveMessageHandler
.void
handleMessage
(Message<?> message)
-
Constructor Details
-
ReactiveMessageHandlerAdapter
Instantiate based on the providedReactiveMessageHandler
.- Parameters:
reactiveMessageHandler
- theReactiveMessageHandler
to delegate to.
-
-
Method Details
-
getDelegate
Get access to the delegateReactiveMessageHandler
. Typically used in the framework internally in components which can compose reactive streams internally and allow us to avoid an explicitsubscribe()
call.- Returns:
- the
ReactiveMessageHandler
this instance is delegating to.
-
handleMessage
- Specified by:
handleMessage
in interfaceMessageHandler
- Throws:
MessagingException
-