public class AnnotationMethodMessageHandler extends Object implements MessageHandler, ApplicationContextAware, InitializingBean
| Constructor and Description |
|---|
AnnotationMethodMessageHandler(SimpMessageSendingOperations dispatchMessagingTemplate,
MessageChannel webSocketSessionChannel) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
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(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
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(ApplicationContext applicationContext) throws BeansException
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) and
MessageSourceAware, if applicable.
setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectApplicationContextException - in case of context initialization errorsBeansException - if thrown by application context methodsBeanInitializationExceptionpublic void afterPropertiesSet()
InitializingBeanThis method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet in interface 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)