public abstract class AbstractMessageBrokerConfiguration
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
clientInboundChannel()
and clientOutboundChannel()
deliver
messages to and from remote clients to several message handlers such as
simpAnnotationMethodMessageHandler()
simpleBrokerMessageHandler()
stompBrokerRelayMessageHandler()
userDestinationMessageHandler()
brokerChannel()
delivers messages from within the application to the
the respective message handlers. brokerMessagingTemplate()
can be injected
into any application component to send messages.
Subclasses are responsible for the part of the configuration that feed messages to and from the client inbound/outbound channels (e.g. STOMP over WebSocket).
Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageBrokerConfiguration()
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers) |
protected void |
addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers) |
AbstractSubscribableChannel |
brokerChannel() |
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor |
brokerChannelExecutor() |
CompositeMessageConverter |
brokerMessageConverter() |
SimpMessagingTemplate |
brokerMessagingTemplate() |
AbstractSubscribableChannel |
clientInboundChannel() |
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor |
clientInboundChannelExecutor() |
AbstractSubscribableChannel |
clientOutboundChannel() |
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor |
clientOutboundChannelExecutor() |
protected void |
configureClientInboundChannel(ChannelRegistration registration)
A hook for subclasses to customize the message channel for inbound messages
from WebSocket clients.
|
protected void |
configureClientOutboundChannel(ChannelRegistration registration)
A hook for subclasses to customize the message channel for messages from
the application or message broker to WebSocket clients.
|
protected void |
configureMessageBroker(MessageBrokerRegistry registry)
A hook for subclasses to customize message broker configuration through the
provided
MessageBrokerRegistry instance. |
protected boolean |
configureMessageConverters(java.util.List<MessageConverter> messageConverters)
Override this method to add custom message converters.
|
protected SimpAnnotationMethodMessageHandler |
createAnnotationMethodMessageHandler()
Protected method for plugging in a custom subclass of
SimpAnnotationMethodMessageHandler . |
protected MappingJackson2MessageConverter |
createJacksonConverter() |
protected abstract SimpUserRegistry |
createLocalUserRegistry()
Create the user registry that provides access to the local users.
|
org.springframework.context.ApplicationContext |
getApplicationContext() |
protected MessageBrokerRegistry |
getBrokerRegistry()
An accessor for the
MessageBrokerRegistry that ensures its one-time creation
and initialization through configureMessageBroker(MessageBrokerRegistry) . |
protected ChannelRegistration |
getClientInboundChannelRegistration() |
protected ChannelRegistration |
getClientOutboundChannelRegistration() |
org.springframework.util.PathMatcher |
getPathMatcher()
Provide access to the configured PatchMatcher for access from other
configuration classes.
|
org.springframework.validation.Validator |
getValidator()
Override this method to provide a custom
Validator . |
org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler |
messageBrokerTaskScheduler() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
SimpAnnotationMethodMessageHandler |
simpAnnotationMethodMessageHandler() |
AbstractBrokerMessageHandler |
simpleBrokerMessageHandler() |
protected org.springframework.validation.Validator |
simpValidator()
Return a
Validator s instance for validating
@Payload method arguments. |
AbstractBrokerMessageHandler |
stompBrokerRelayMessageHandler() |
UserDestinationMessageHandler |
userDestinationMessageHandler() |
UserDestinationResolver |
userDestinationResolver() |
SimpUserRegistry |
userRegistry() |
MessageHandler |
userRegistryMessageHandler() |
protected UserSessionRegistry |
userSessionRegistry()
Deprecated.
|
protected AbstractMessageBrokerConfiguration()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public org.springframework.context.ApplicationContext getApplicationContext()
@Bean public AbstractSubscribableChannel clientInboundChannel()
@Bean public org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor clientInboundChannelExecutor()
protected final ChannelRegistration getClientInboundChannelRegistration()
protected void configureClientInboundChannel(ChannelRegistration registration)
@Bean public AbstractSubscribableChannel clientOutboundChannel()
@Bean public org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor clientOutboundChannelExecutor()
protected final ChannelRegistration getClientOutboundChannelRegistration()
protected void configureClientOutboundChannel(ChannelRegistration registration)
@Bean public AbstractSubscribableChannel brokerChannel()
@Bean public org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor brokerChannelExecutor()
protected final MessageBrokerRegistry getBrokerRegistry()
MessageBrokerRegistry
that ensures its one-time creation
and initialization through configureMessageBroker(MessageBrokerRegistry)
.protected void configureMessageBroker(MessageBrokerRegistry registry)
MessageBrokerRegistry
instance.public final org.springframework.util.PathMatcher getPathMatcher()
@Bean public SimpAnnotationMethodMessageHandler simpAnnotationMethodMessageHandler()
protected SimpAnnotationMethodMessageHandler createAnnotationMethodMessageHandler()
SimpAnnotationMethodMessageHandler
.protected void addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
protected void addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
@Bean public AbstractBrokerMessageHandler simpleBrokerMessageHandler()
@Bean public AbstractBrokerMessageHandler stompBrokerRelayMessageHandler()
@Bean public UserDestinationMessageHandler userDestinationMessageHandler()
@Bean public MessageHandler userRegistryMessageHandler()
@Bean(name={"messageBrokerTaskScheduler","messageBrokerSockJsTaskScheduler"}) public org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler messageBrokerTaskScheduler()
@Bean public SimpMessagingTemplate brokerMessagingTemplate()
@Bean public CompositeMessageConverter brokerMessageConverter()
protected MappingJackson2MessageConverter createJacksonConverter()
protected boolean configureMessageConverters(java.util.List<MessageConverter> messageConverters)
messageConverters
- the list to add converters to, initially emptytrue
if default message converters should be added to list,
false
if no more converters should be added.@Bean public UserDestinationResolver userDestinationResolver()
@Bean public SimpUserRegistry userRegistry()
protected abstract SimpUserRegistry createLocalUserRegistry()
@Deprecated protected UserSessionRegistry userSessionRegistry()
UserSessionRegistry
is deprecated in favor of SimpUserRegistry
exposing information about all connected users. The MultiServerUserRegistry
implementation in combination with UserRegistryMessageHandler
can be used
to share user registries across multiple servers.protected org.springframework.validation.Validator simpValidator()
Validator
s instance for validating
@Payload
method arguments.
In order, this method tries to get a Validator instance:
OptionalValidatorFactoryBean
public org.springframework.validation.Validator getValidator()
Validator
.