public class ReactiveMessageHandlerAdapter extends Object implements MessageHandler
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
.
ReactiveStreamsConsumer
Constructor and Description |
---|
ReactiveMessageHandlerAdapter(ReactiveMessageHandler reactiveMessageHandler)
Instantiate based on the provided
ReactiveMessageHandler . |
Modifier and Type | Method and Description |
---|---|
ReactiveMessageHandler |
getDelegate()
Get access to the delegate
ReactiveMessageHandler . |
void |
handleMessage(Message<?> message) |
public ReactiveMessageHandlerAdapter(ReactiveMessageHandler reactiveMessageHandler)
ReactiveMessageHandler
.reactiveMessageHandler
- the ReactiveMessageHandler
to delegate to.public ReactiveMessageHandler getDelegate()
ReactiveMessageHandler
.
Typically used in the framework internally in components which can compose reactive streams internally
and allow us to avoid an explicit subscribe()
call.ReactiveMessageHandler
this instance is delegating to.public void handleMessage(Message<?> message) throws MessagingException
handleMessage
in interface MessageHandler
MessagingException