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 class org.springframework.integration.gateway.MessagingGatewaySupport
MessagingGatewaySupport.ConvertingMessagingTemplate
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
messagingTemplate
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLock
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionRSocketInboundGateway
(String... pathArg) Instantiate based on the provided path patterns to map this endpoint for incoming RSocket requests. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Subclasses must implement this method with the start behavior.ObtainRSocketInteractionModel
s thisReactiveMessageHandler
is 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 void
onInit()
Subclasses may implement this for initialization logic.void
setDecodeFluxAsUnit
(boolean decodeFluxAsUnit) Configure an option to decode an incomingFlux
as a single unit or each its event separately.void
setInteractionModels
(RSocketInteractionModel... interactionModelsArg) Configure a set ofRSocketInteractionModel
this endpoint is mapped onto.void
setRequestElementClass
(Class<?> requestElementClass) Specify a type of payload to be generated when the inbound RSocket request content is read by the encoders.void
setRequestElementType
(ResolvableType requestElementType) Specify the type of payload to be generated when the inbound RSocket request content is read by the converters/encoders.void
setRSocketConnector
(AbstractRSocketConnector rsocketConnector) Provide anAbstractRSocketConnector
reference for an explicit endpoint mapping.void
setRSocketStrategies
(RSocketStrategies rsocketStrategies) Configure anRSocketStrategies
instead of a default one.Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport
buildErrorMessage, buildSendTimer, destroy, doStop, getComponentType, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReceiverObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrack
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
Methods 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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods 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 anRSocketStrategies
instead of a default one. Note: ifAbstractRSocketConnector
is provided, then itsRSocketStrategies
have a precedence.- Parameters:
rsocketStrategies
- theRSocketStrategies
to use.- See Also:
-
setRSocketConnector
Provide anAbstractRSocketConnector
reference for an explicit endpoint mapping.- Parameters:
rsocketConnector
- theAbstractRSocketConnector
to use.
-
setInteractionModels
Configure a set ofRSocketInteractionModel
this endpoint is mapped onto.- Parameters:
interactionModelsArg
- theRSocketInteractionModel
s for mapping.- Since:
- 5.2.2
-
getInteractionModels
Description copied from interface:IntegrationRSocketEndpoint
ObtainRSocketInteractionModel
s thisReactiveMessageHandler
is going to be mapped onto. Defaults to all theRSocketInteractionModel
s.- Specified by:
getInteractionModels
in interfaceIntegrationRSocketEndpoint
- Returns:
- the interaction models for mapping.
-
getPath
Get an array of the path patterns this endpoint is mapped onto.- Specified by:
getPath
in 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 incomingFlux
as a single unit or each its event separately. Defaults tofalse
for consistency with Spring Messaging@MessageMapping
. The targetFlux
decoding logic depends on theDecoder
selected. For example aStringDecoder
requires a new line separator to be present in the stream to indicate a byte buffer end.- Parameters:
decodeFluxAsUnit
- decode incomingFlux
as a single unit or each event separately.- Since:
- 5.3
- See Also:
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classMessagingGatewaySupport
-
doStart
protected void doStart()Description copied from class:AbstractEndpoint
Subclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock
.- Overrides:
doStart
in classMessagingGatewaySupport
-
handleMessage
- Specified by:
handleMessage
in interfaceReactiveMessageHandler
-