public class AnnotationMethodMessageHandler extends Object implements MessageHandler, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
| Constructor and Description |
|---|
AnnotationMethodMessageHandler(SimpMessageSendingOperations dispatchMessagingTemplate,
MessageChannel webSocketSessionChannel) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected HandlerMethod |
createHandlerMethod(Object handler,
Method method) |
protected void |
detectHandlerMethods(Object handler) |
List<String> |
getDestinationPrefixes() |
protected HandlerMethod |
getHandlerMethod(String destination,
Map<org.springframework.messaging.simp.handler.AnnotationMethodMessageHandler.MappingInfo,HandlerMethod> handlerMethods) |
MessageConverter<?> |
getMessageConverter() |
void |
handleMessage(Message<?> message)
Handles the message if possible.
|
protected void |
initHandlerMethods() |
protected boolean |
isHandler(Class<?> beanType) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setDestinationPrefixes(List<String> destinationPrefixes) |
void |
setMessageConverter(MessageConverter<?> converter) |
public AnnotationMethodMessageHandler(SimpMessageSendingOperations dispatchMessagingTemplate, MessageChannel webSocketSessionChannel)
dispatchMessagingTemplate - a messaging template to dispatch messages to for
further processing, e.g. the use of an ReplyTo annotation on a
message handling method, causes a new (broadcast) message to be sent.webSocketSessionChannel - the channel to send messages to WebSocket sessions
on this application server. This is used primarily for processing the return
values from SubscribeEvent-annotated methods.public void setMessageConverter(MessageConverter<?> converter)
public MessageConverter<?> getMessageConverter()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanprotected void initHandlerMethods()
protected boolean isHandler(Class<?> beanType)
protected void detectHandlerMethods(Object handler)
protected HandlerMethod createHandlerMethod(Object handler, Method method)
public void handleMessage(Message<?> message) throws MessagingException
MessageHandlerMessageRejectedException e.g.
in case of a Selective Consumer. When a consumer tries to handle a
message, but fails to do so, a MessageHandlingException is
thrown. In the last case it is recommended to treat the message as tainted
and go into an error scenario.
When the handling results in a failure of another message being sent
(e.g. a "reply" message), that failure will trigger a
MessageDeliveryException.
handleMessage in interface MessageHandlermessage - the message to be handled
reply related to the handling of the messageMessagingExceptionprotected HandlerMethod getHandlerMethod(String destination, Map<org.springframework.messaging.simp.handler.AnnotationMethodMessageHandler.MappingInfo,HandlerMethod> handlerMethods)