Class RSocketInboundGateway
- All Implemented Interfaces:
Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,Lifecycle,Phased,SmartLifecycle,ExpressionCapable,IntegrationPattern,IntegrationRSocketEndpoint,NamedComponent,IntegrationInboundManagement,IntegrationManagement,ManageableLifecycle,ManageableSmartLifecycle,TrackableComponent,ReactiveMessageHandler
MessagingGatewaySupport implementation for the IntegrationRSocketEndpoint.
Represents an inbound endpoint for RSocket requests.
May be configured with the AbstractRSocketConnector for mapping registration.
Or existing AbstractRSocketConnector bean(s) will perform detection automatically.
An inbound DataBuffer (either single or as a Publisher element) is
converted to the target expected type which can be configured by the
setRequestElementClass(java.lang.Class<?>) or setRequestElementType(ResolvableType).
If it is not configured, then target type is determined by the contentType header:
If it is a text, then target type is String, otherwise - byte[].
An inbound Publisher is used as is in the message to send payload.
It is a target application responsibility to process that payload any possible way.
A reply payload is encoded to the Flux according a type of the payload or a
Publisher element type.
- Since:
- 5.2
- Author:
- 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.gateway.MessagingGatewaySupport
messagingTemplateFields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionRSocketInboundGateway(String... pathArg) Instantiate based on the provided path patterns to map this endpoint for incoming RSocket requests. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()Subclasses must implement this method with the start behavior.ObtainRSocketInteractionModels thisReactiveMessageHandleris going to be mapped onto.String[]getPath()Get an array of the path patterns this endpoint is mapped onto.reactor.core.publisher.Mono<Void>handleMessage(Message<?> requestMessage) protected voidonInit()Subclasses may implement this for initialization logic.voidsetDecodeFluxAsUnit(boolean decodeFluxAsUnit) Configure an option to decode an incomingFluxas a single unit or each its event separately.voidsetInteractionModels(RSocketInteractionModel... interactionModelsArg) Configure a set ofRSocketInteractionModelthis endpoint is mapped onto.voidsetRequestElementClass(Class<?> requestElementClass) Specify a type of payload to be generated when the inbound RSocket request content is read by the encoders.voidsetRequestElementType(ResolvableType requestElementType) Specify the type of payload to be generated when the inbound RSocket request content is read by the converters/encoders.voidsetRSocketConnector(AbstractRSocketConnector rsocketConnector) Provide anAbstractRSocketConnectorreference for an explicit endpoint mapping.voidsetRSocketStrategies(RSocketStrategies rsocketStrategies) Configure anRSocketStrategiesinstead of a default one.Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
buildErrorMessage, buildSendTimer, destroy, doStop, getComponentType, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackMethods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
RSocketInboundGateway
Instantiate based on the provided path patterns to map this endpoint for incoming RSocket requests.- Parameters:
pathArg- the mapping patterns to use.
-
-
Method Details
-
setRSocketStrategies
Configure anRSocketStrategiesinstead of a default one. Note: ifAbstractRSocketConnectoris provided, then itsRSocketStrategieshave a precedence.- Parameters:
rsocketStrategies- theRSocketStrategiesto use.- See Also:
-
setRSocketConnector
Provide anAbstractRSocketConnectorreference for an explicit endpoint mapping.- Parameters:
rsocketConnector- theAbstractRSocketConnectorto use.
-
setInteractionModels
Configure a set ofRSocketInteractionModelthis endpoint is mapped onto.- Parameters:
interactionModelsArg- theRSocketInteractionModels for mapping.- Since:
- 5.2.2
-
getInteractionModels
Description copied from interface:IntegrationRSocketEndpointObtainRSocketInteractionModels thisReactiveMessageHandleris going to be mapped onto. Defaults to all theRSocketInteractionModels.- Specified by:
getInteractionModelsin interfaceIntegrationRSocketEndpoint- Returns:
- the interaction models for mapping.
-
getPath
Get an array of the path patterns this endpoint is mapped onto.- Specified by:
getPathin interfaceIntegrationRSocketEndpoint- Returns:
- the mapping path
-
setRequestElementClass
Specify a type of payload to be generated when the inbound RSocket request content is read by the encoders. By default this value is null which means at runtime any "text" Content-Type will result in String while all others default tobyte[].class.- Parameters:
requestElementClass- The payload type.
-
setRequestElementType
Specify the type of payload to be generated when the inbound RSocket request content is read by the converters/encoders. By default this value is null which means at runtime any "text" Content-Type will result in String while all others default tobyte[].class.- Parameters:
requestElementType- The payload type.
-
setDecodeFluxAsUnit
public void setDecodeFluxAsUnit(boolean decodeFluxAsUnit) Configure an option to decode an incomingFluxas a single unit or each its event separately. Defaults tofalsefor consistency with Spring Messaging@MessageMapping. The targetFluxdecoding logic depends on theDecoderselected. For example aStringDecoderrequires a new line separator to be present in the stream to indicate a byte buffer end.- Parameters:
decodeFluxAsUnit- decode incomingFluxas a single unit or each event separately.- Since:
- 5.3
- See Also:
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classMessagingGatewaySupport
-
doStart
protected void doStart()Description copied from class:AbstractEndpointSubclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Overrides:
doStartin classMessagingGatewaySupport
-
handleMessage
- Specified by:
handleMessagein interfaceReactiveMessageHandler
-