Class AbstractMessageBrokerConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
clientInboundChannel(Executor) and clientOutboundChannel(Executor) deliver
messages to and from remote clients to several message handlers such as the
following.
simpAnnotationMethodMessageHandler(AbstractSubscribableChannel, AbstractSubscribableChannel, SimpMessagingTemplate, CompositeMessageConverter)simpleBrokerMessageHandler(AbstractSubscribableChannel, AbstractSubscribableChannel, AbstractSubscribableChannel, UserDestinationResolver)stompBrokerRelayMessageHandler(AbstractSubscribableChannel, AbstractSubscribableChannel, AbstractSubscribableChannel, UserDestinationMessageHandler, MessageHandler, UserDestinationResolver)userDestinationMessageHandler(AbstractSubscribableChannel, AbstractSubscribableChannel, AbstractSubscribableChannel, UserDestinationResolver)
brokerChannel(AbstractSubscribableChannel, AbstractSubscribableChannel, Executor) delivers messages from within the application to the
respective message handlers. brokerMessagingTemplate(AbstractSubscribableChannel, AbstractSubscribableChannel, AbstractSubscribableChannel, 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 (for example, STOMP over WebSocket).
- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Brian Clozel, Sebastien Deleuze
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) protected voidaddReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) brokerChannel(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, Executor executor) brokerChannelExecutor(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) brokerMessagingTemplate(AbstractSubscribableChannel brokerChannel, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, CompositeMessageConverter brokerMessageConverter) clientInboundChannel(Executor executor) clientOutboundChannel(Executor 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 MappingJackson2MessageConverterAllow to customize Jackson 2.x JSON converter.protected JacksonJsonMessageConverterAllow to customize Jackson 3.x JSON converter.protected abstract SimpUserRegistryCreate the user registry that provides access to local users.@Nullable org.springframework.context.ApplicationContextprotected final MessageBrokerRegistrygetBrokerRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) An accessor for theMessageBrokerRegistrythat ensures its one-time creation and initialization throughconfigureMessageBroker(MessageBrokerRegistry).protected final ChannelRegistrationprotected final ChannelRegistrationfinal @Nullable org.springframework.util.PathMatchergetPathMatcher(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) Provide access to the configured PatchMatcher for access from other configuration classes.protected final intgetPhase()@Nullable org.springframework.validation.ValidatorOverride this method to provide a customValidator.protected intorg.springframework.scheduling.TaskSchedulervoidsetApplicationContext(@Nullable org.springframework.context.ApplicationContext applicationContext) simpAnnotationMethodMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpMessagingTemplate brokerMessagingTemplate, CompositeMessageConverter brokerMessageConverter) simpleBrokerMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) protected org.springframework.validation.ValidatorReturn anValidatorinstance for validating@Payloadmethod arguments.stompBrokerRelayMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationMessageHandler userDestinationMessageHandler, @Nullable 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, org.springframework.scheduling.TaskScheduler scheduler)
-
Constructor Details
-
AbstractMessageBrokerConfiguration
protected AbstractMessageBrokerConfiguration()Protected constructor.
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(@Nullable org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getApplicationContext
-
clientInboundChannel
@Bean public AbstractSubscribableChannel clientInboundChannel(@Qualifier("clientInboundChannelExecutor") Executor executor) -
clientInboundChannelExecutor
-
getClientInboundChannelRegistration
-
getPhase
protected final int getPhase() -
initPhase
protected int initPhase() -
configureClientInboundChannel
A hook for subclasses to customize the message channel for inbound messages from WebSocket clients. -
clientOutboundChannel
@Bean public AbstractSubscribableChannel clientOutboundChannel(@Qualifier("clientOutboundChannelExecutor") Executor executor) -
clientOutboundChannelExecutor
-
getClientOutboundChannelRegistration
-
configureClientOutboundChannel
A 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") Executor executor) -
brokerChannelExecutor
@Bean public Executor brokerChannelExecutor(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) -
getBrokerRegistry
protected final MessageBrokerRegistry getBrokerRegistry(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel) An accessor for theMessageBrokerRegistrythat ensures its one-time creation and initialization throughconfigureMessageBroker(MessageBrokerRegistry). -
configureMessageBroker
A hook for subclasses to customize message broker configuration through the providedMessageBrokerRegistryinstance. -
getPathMatcher
public final @Nullable org.springframework.util.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) -
createAnnotationMethodMessageHandler
protected 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 public @Nullable AbstractBrokerMessageHandler simpleBrokerMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, AbstractSubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver) -
stompBrokerRelayMessageHandler
@Bean public @Nullable 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 public @Nullable MessageHandler userRegistryMessageHandler(AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, SimpUserRegistry userRegistry, SimpMessagingTemplate brokerMessagingTemplate, @Qualifier("messageBrokerTaskScheduler") org.springframework.scheduling.TaskScheduler scheduler) -
messageBrokerTaskScheduler
@Bean(name={"messageBrokerTaskScheduler","messageBrokerSockJsTaskScheduler"}) public org.springframework.scheduling.TaskScheduler messageBrokerTaskScheduler() -
brokerMessagingTemplate
@Bean public SimpMessagingTemplate brokerMessagingTemplate(AbstractSubscribableChannel brokerChannel, AbstractSubscribableChannel clientInboundChannel, AbstractSubscribableChannel clientOutboundChannel, CompositeMessageConverter brokerMessageConverter) -
brokerMessageConverter
-
createJacksonJsonConverter
Allow to customize Jackson 3.x JSON converter. -
createJacksonConverter
Allow to customize Jackson 2.x JSON converter. -
configureMessageConverters
Override 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) -
createLocalUserRegistry
Create the user registry that provides access to local users.- Parameters:
order- the order to use as aSmartApplicationListener.- Since:
- 5.1
-
simpValidator
protected org.springframework.validation.Validator simpValidator()Return 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
-
getValidator
Override this method to provide a customValidator.- Since:
- 4.0.1
-