Class RSocketOutboundGateway

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class RSocketOutboundGateway extends AbstractReplyProducingMessageHandler
An Outbound Messaging Gateway for RSocket requests. The request logic is fully based on the RSocketRequester, which can be obtained from the ClientRSocketConnector on the client side or from the RSocketRequesterMethodArgumentResolver.RSOCKET_REQUESTER_HEADER request message header on the server side.

An RSocket operation is determined by the configured RSocketInteractionModel or respective SpEL expression to be evaluated at runtime against the request message. By default the RSocketInteractionModel.requestResponse operation is used.

For a Publisher-based requests, it must be present in the request message payload. The flattening via upstream FluxMessageChannel will work, too, but this way we will lose a scope of particular request and every Publisher event will be send in its own plain request.

If reply is a Flux, it is wrapped to the Mono to retain a request scope. The downstream flow is responsible to obtain this Flux from a message payload and subscribe to it by itself. The Mono reply from this component is subscribed from the downstream FluxMessageChannel or it is adapted to the ListenableFuture otherwise.

Artem Bilan
See Also: