Class RSocketOutboundGateway

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ComponentSourceAware, 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 sent 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 CompletableFuture otherwise.

Since:
5.2
Author:
Artem Bilan
See Also:
  • Constructor Details

    • RSocketOutboundGateway

      public RSocketOutboundGateway(String route, Object @Nullable ... routeVariables)
      Instantiate based on the provided RSocket endpoint route and optional variables to expand route template.
      Parameters:
      route - the RSocket endpoint route to use.
      routeVariables - the variables to expand route template.
    • RSocketOutboundGateway

      public RSocketOutboundGateway(Expression routeExpression)
      Instantiate based on the provided SpEL expression to evaluate an RSocket endpoint route at runtime against a request message. If route is a template and variables expansion is required, it is recommended to do that in this expression evaluation, for example using some bean with an appropriate logic.
      Parameters:
      routeExpression - the SpEL expression to use.
  • Method Details