Class AbstractMessageBrokerConfiguration
- All Implemented Interfaces:
- Aware,- ApplicationContextAware
- Direct Known Subclasses:
- WebSocketMessageBrokerConfigurationSupport
clientInboundChannel(org.springframework.core.task.TaskExecutor) and clientOutboundChannel(org.springframework.core.task.TaskExecutor) deliver
 messages to and from remote clients to several message handlers such as the
 following.
 
- simpAnnotationMethodMessageHandler(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.simp.SimpMessagingTemplate, org.springframework.messaging.converter.CompositeMessageConverter)
- simpleBrokerMessageHandler(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.simp.user.UserDestinationResolver)
- stompBrokerRelayMessageHandler(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.simp.user.UserDestinationMessageHandler, org.springframework.messaging.MessageHandler, org.springframework.messaging.simp.user.UserDestinationResolver)
- userDestinationMessageHandler(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.simp.user.UserDestinationResolver)
brokerChannel(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.core.task.TaskExecutor) delivers messages from within the application to the
 respective message handlers. brokerMessagingTemplate(org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.support.AbstractSubscribableChannel, org.springframework.messaging.converter.CompositeMessageConverter) can be injected
 into any application component to send messages.
 
Subclasses are responsible for the parts of the configuration that feed messages to and from the client inbound/outbound channels (e.g. STOMP over WebSocket).
- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Brian Clozel, Sebastien Deleuze
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedProtected constructor.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) protected voidaddReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) brokerChannel(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, TaskExecutor executor) brokerChannelExecutor(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) brokerMessagingTemplate(AbstractSubscribableChannel brokerChannel, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, CompositeMessageConverter brokerMessageConverter) clientInboundChannel(TaskExecutor executor) clientOutboundChannel(TaskExecutor executor) protected voidconfigureClientInboundChannel(ChannelRegistration registration) A hook for subclasses to customize the message channel for inbound messages from WebSocket clients.protected voidconfigureClientOutboundChannel(ChannelRegistration registration) A hook for subclasses to customize the message channel for messages from the application or message broker to WebSocket clients.protected voidconfigureMessageBroker(MessageBrokerRegistry registry) A hook for subclasses to customize message broker configuration through the providedMessageBrokerRegistryinstance.protected booleanconfigureMessageConverters(List<MessageConverter> messageConverters) Override this method to add custom message converters.protected SimpAnnotationMethodMessageHandlercreateAnnotationMethodMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpMessagingTemplate brokerMessagingTemplate) Protected method for plugging in a custom subclass ofSimpAnnotationMethodMessageHandler.protected MappingJackson2MessageConverterprotected abstract SimpUserRegistrycreateLocalUserRegistry(Integer order) Create the user registry that provides access to local users.protected final MessageBrokerRegistrygetBrokerRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) An accessor for theMessageBrokerRegistrythat ensures its one-time creation and initialization throughconfigureMessageBroker(MessageBrokerRegistry).protected final ChannelRegistrationprotected final ChannelRegistrationfinal PathMatchergetPathMatcher(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) Provide access to the configured PatchMatcher for access from other configuration classes.Override this method to provide a customValidator.voidsetApplicationContext(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.simpAnnotationMethodMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpMessagingTemplate brokerMessagingTemplate, CompositeMessageConverter brokerMessageConverter) simpleBrokerMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) protected ValidatorReturn anValidatorinstance for validating@Payloadmethod arguments.stompBrokerRelayMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationMessageHandler userDestinationMessageHandler, MessageHandler userRegistryMessageHandler, UserDestinationResolver userDestinationResolver) userDestinationMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) userDestinationResolver(SimpUserRegistry userRegistry, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) userRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) userRegistryMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpUserRegistry userRegistry, SimpMessagingTemplate brokerMessagingTemplate, TaskScheduler scheduler) 
- 
Constructor Details- 
AbstractMessageBrokerConfigurationprotected AbstractMessageBrokerConfiguration()Protected constructor.
 
- 
- 
Method Details- 
setApplicationContextDescription copied from interface:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)andMessageSourceAware, if applicable.- Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Parameters:
- applicationContext- the ApplicationContext object to be used by this object
- See Also:
 
- 
getApplicationContext
- 
clientInboundChannel@Bean public AbstractSubscribableChannel clientInboundChannel(@Qualifier("clientInboundChannelExecutor") TaskExecutor executor) 
- 
clientInboundChannelExecutor
- 
getClientInboundChannelRegistration
- 
configureClientInboundChannelA hook for subclasses to customize the message channel for inbound messages from WebSocket clients.
- 
clientOutboundChannel@Bean public AbstractSubscribableChannel clientOutboundChannel(@Qualifier("clientOutboundChannelExecutor") TaskExecutor executor) 
- 
clientOutboundChannelExecutor
- 
getClientOutboundChannelRegistration
- 
configureClientOutboundChannelA hook for subclasses to customize the message channel for messages from the application or message broker to WebSocket clients.
- 
brokerChannel@Bean public AbstractSubscribableChannel brokerChannel(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, @Qualifier("brokerChannelExecutor") TaskExecutor executor) 
- 
brokerChannelExecutor@Bean public TaskExecutor brokerChannelExecutor(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) 
- 
getBrokerRegistryprotected final MessageBrokerRegistry getBrokerRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) An accessor for theMessageBrokerRegistrythat ensures its one-time creation and initialization throughconfigureMessageBroker(MessageBrokerRegistry).
- 
configureMessageBrokerA hook for subclasses to customize message broker configuration through the providedMessageBrokerRegistryinstance.
- 
getPathMatcher@Nullable public final PathMatcher getPathMatcher(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) Provide access to the configured PatchMatcher for access from other configuration classes.
- 
simpAnnotationMethodMessageHandler@Bean public SimpAnnotationMethodMessageHandler simpAnnotationMethodMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpMessagingTemplate brokerMessagingTemplate, CompositeMessageConverter brokerMessageConverter) 
- 
createAnnotationMethodMessageHandlerprotected SimpAnnotationMethodMessageHandler createAnnotationMethodMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpMessagingTemplate brokerMessagingTemplate) Protected method for plugging in a custom subclass ofSimpAnnotationMethodMessageHandler.- Since:
- 5.3.2
 
- 
addArgumentResolvers
- 
addReturnValueHandlers
- 
simpleBrokerMessageHandler@Bean @Nullable public AbstractBrokerMessageHandler simpleBrokerMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) 
- 
stompBrokerRelayMessageHandler@Bean @Nullable public AbstractBrokerMessageHandler stompBrokerRelayMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationMessageHandler userDestinationMessageHandler, @Nullable MessageHandler userRegistryMessageHandler, UserDestinationResolver userDestinationResolver) 
- 
userDestinationMessageHandler@Bean public UserDestinationMessageHandler userDestinationMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) 
- 
userRegistryMessageHandler@Bean @Nullable public MessageHandler userRegistryMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpUserRegistry userRegistry, SimpMessagingTemplate brokerMessagingTemplate, @Qualifier("messageBrokerTaskScheduler") TaskScheduler scheduler) 
- 
messageBrokerTaskScheduler@Bean(name={"messageBrokerTaskScheduler","messageBrokerSockJsTaskScheduler"}) public TaskScheduler messageBrokerTaskScheduler()
- 
brokerMessagingTemplate@Bean public SimpMessagingTemplate brokerMessagingTemplate(AbstractSubscribableChannel brokerChannel, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, CompositeMessageConverter brokerMessageConverter) 
- 
brokerMessageConverter
- 
createJacksonConverter
- 
configureMessageConvertersOverride this method to add custom message converters.- Parameters:
- messageConverters- the list to add converters to, initially empty
- Returns:
- trueif default message converters should be added to list,- falseif no more converters should be added
 
- 
userDestinationResolver@Bean public UserDestinationResolver userDestinationResolver(SimpUserRegistry userRegistry, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) 
- 
userRegistry@Bean public SimpUserRegistry userRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) 
- 
createLocalUserRegistryCreate the user registry that provides access to local users.- Parameters:
- order- the order to use as a- SmartApplicationListener.
- Since:
- 5.1
 
- 
simpValidatorReturn anValidatorinstance for validating@Payloadmethod arguments.In order, this method tries to get a Validator instance: - delegating to getValidator() first
- if none returned, getting an existing instance with its well-known name "mvcValidator", created by an MVC configuration
- if none returned, checking the classpath for the presence of a JSR-303 implementation
 before creating a OptionalValidatorFactoryBean
- returning a no-op Validator instance
 
- 
getValidatorOverride this method to provide a customValidator.- Since:
- 4.0.1
 
 
-