Class WebSocketInboundChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.websocket.inbound.WebSocketInboundChannelAdapter
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- SmartInitializingSingleton,- ApplicationContextAware,- ApplicationEventPublisherAware,- Lifecycle,- Phased,- SmartLifecycle,- ComponentSourceAware,- ExpressionCapable,- MessageProducer,- IntegrationPattern,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent,- WebSocketListener,- SubProtocolCapable
public class WebSocketInboundChannelAdapter
extends MessageProducerSupport
implements WebSocketListener, ApplicationEventPublisherAware
The 
MessageProducerSupport for inbound WebSocket messages.- Since:
- 4.1
- Author:
- Artem Bilan, Ngoc Nhan
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionWebSocketInboundChannelAdapter(IntegrationWebSocketContainer webSocketContainer) WebSocketInboundChannelAdapter(IntegrationWebSocketContainer webSocketContainer, SubProtocolHandlerRegistry protocolHandlerRegistry) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidafterSessionEnded(WebSocketSession session, CloseStatus closeStatus) Invoked after aWebSocketSessionhas ended.voidafterSessionStarted(WebSocketSession session) Invoked after aWebSocketSessionhas started.protected voiddoStart()Take no action by default.protected voiddoStop()Take no action by default.Subclasses may implement this method to provide component type information.booleanisActive()protected voidonInit()Subclasses may implement this for initialization logic.voidonMessage(WebSocketSession session, WebSocketMessage<?> webSocketMessage) Handle the receivedWebSocketMessage.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetMergeWithDefaultConverters(boolean mergeWithDefaultConverters) Flag which determines if the default converters should be available after custom converters.voidsetMessageConverters(List<MessageConverter> messageConverters) Set the message converters to use.voidsetPayloadType(Class<?> payloadType) Set the type for target message payload to convert the WebSocket message body to.voidsetUseBroker(boolean useBroker) Specify if this adapter should use an existing singleAbstractBrokerMessageHandlerbean fornon-MESSAGEWebSocketMessages and to route messages with broker destinations.Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupportafterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, getRequiredOutputChannel, isObserved, registerObservationRegistry, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setObservationConvention, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdestroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementdestroy, getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
WebSocketInboundChannelAdapter
- 
WebSocketInboundChannelAdapterpublic WebSocketInboundChannelAdapter(IntegrationWebSocketContainer webSocketContainer, SubProtocolHandlerRegistry protocolHandlerRegistry) 
 
- 
- 
Method Details- 
setMessageConvertersSet the message converters to use. These converters are used to convert the message to send for appropriate internal subProtocols type.- Parameters:
- messageConverters- The message converters.
 
- 
setMergeWithDefaultConverterspublic void setMergeWithDefaultConverters(boolean mergeWithDefaultConverters) Flag which determines if the default converters should be available after custom converters.- Parameters:
- mergeWithDefaultConverters- true to merge, false to replace.
 
- 
setPayloadTypeSet the type for target message payload to convert the WebSocket message body to.- Parameters:
- payloadType- to convert inbound WebSocket message body
- See Also:
 
- 
setUseBrokerpublic void setUseBroker(boolean useBroker) Specify if this adapter should use an existing singleAbstractBrokerMessageHandlerbean fornon-MESSAGEWebSocketMessages and to route messages with broker destinations. Since only singleAbstractBrokerMessageHandlerbean is allowed in the current application context, the algorithm to lookup the former by type, rather than applying the bean reference. This is used only on server side and is ignored from client side.- Parameters:
- useBroker- the boolean flag.
 
- 
setApplicationEventPublisher- Specified by:
- setApplicationEventPublisherin interface- ApplicationEventPublisherAware
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- MessageProducerSupport
 
- 
getSubProtocols- Specified by:
- getSubProtocolsin interface- SubProtocolCapable
 
- 
afterSessionStartedDescription copied from interface:WebSocketListenerInvoked after aWebSocketSessionhas started.- Specified by:
- afterSessionStartedin interface- WebSocketListener
- Parameters:
- session- the WebSocket session
 
- 
afterSessionEndedDescription copied from interface:WebSocketListenerInvoked after aWebSocketSessionhas ended.- Specified by:
- afterSessionEndedin interface- WebSocketListener
- Parameters:
- session- the WebSocket session
- closeStatus- the reason why the session was closed
 
- 
onMessageDescription copied from interface:WebSocketListenerHandle the receivedWebSocketMessage.- Specified by:
- onMessagein interface- WebSocketListener
- Parameters:
- session- the WebSocket session
- webSocketMessage- the WebSocket message
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- IntegrationObjectSupport
 
- 
doStartprotected void doStart()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.- Overrides:
- doStartin class- MessageProducerSupport
 
- 
doStopprotected void doStop()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
- doStopin class- MessageProducerSupport
 
- 
isActivepublic boolean isActive()- Overrides:
- isActivein class- AbstractEndpoint
 
 
-