diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java index 33bda8bec6c9..2cc06cb90eab 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java @@ -61,6 +61,7 @@ * @author Rossen Stoyanchev * @author Sebastien Deleuze * @author Juergen Hoeller + * @author Sam Brannen * @since 4.0 */ public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry { @@ -121,11 +122,12 @@ public int getCacheLimit() { /** * Configure the name of a header that a subscription message can have for - * the purpose of filtering messages matched to the subscription. The header - * value is expected to be a Spring EL boolean expression to be applied to - * the headers of messages matched to the subscription. + * the purpose of filtering messages matched to the subscription. + *

The header value is expected to be a Spring Expression Language (SpEL) + * boolean expression to be applied to the headers of messages matched to the + * subscription. *

For example: - *

+	 * 
 	 * headers.foo == 'bar'
 	 * 
*

By default this is set to "selector". You can set it to a different @@ -138,8 +140,9 @@ public void setSelectorHeaderName(@Nullable String selectorHeaderName) { } /** - * Return the name for the selector header name. + * Return the name of the selector header. * @since 4.2 + * @see #setSelectorHeaderName(String) */ @Nullable public String getSelectorHeaderName() { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java index e3440d755a0e..d91e5fce1cc4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java @@ -42,10 +42,11 @@ /** * A "simple" message broker that recognizes the message types defined in * {@link SimpMessageType}, keeps track of subscriptions with the help of a - * {@link SubscriptionRegistry} and sends messages to subscribers. + * {@link SubscriptionRegistry}, and sends messages to subscribers. * * @author Rossen Stoyanchev * @author Juergen Hoeller + * @author Sam Brannen * @since 4.0 */ public class SimpleBrokerMessageHandler extends AbstractBrokerMessageHandler { @@ -97,11 +98,12 @@ public SimpleBrokerMessageHandler(SubscribableChannel clientInboundChannel, Mess /** - * Configure a custom SubscriptionRegistry to use for storing subscriptions. - *

Note that when a custom PathMatcher is configured via - * {@link #setPathMatcher}, if the custom registry is not an instance of - * {@link DefaultSubscriptionRegistry}, the provided PathMatcher is not used - * and must be configured directly on the custom registry. + * Configure a custom {@link SubscriptionRegistry} to use for storing subscriptions. + *

NOTE: If the custom registry is not an instance of + * {@link DefaultSubscriptionRegistry}, the configured {@link #setPathMatcher + * PathMatcher}, {@linkplain #setCacheLimit cache limit}, and + * {@linkplain #setSelectorHeaderName selector header name} are not used and + * must be configured directly on the custom registry. */ public void setSubscriptionRegistry(SubscriptionRegistry subscriptionRegistry) { Assert.notNull(subscriptionRegistry, "SubscriptionRegistry must not be null"); @@ -119,6 +121,8 @@ public SubscriptionRegistry getSubscriptionRegistry() { * When configured, the given PathMatcher is passed down to the underlying * SubscriptionRegistry to use for matching destination to subscriptions. *

Default is a standard {@link org.springframework.util.AntPathMatcher}. + *

Setting this property has no effect if the underlying SubscriptionRegistry + * is not an instance of {@link DefaultSubscriptionRegistry}. * @since 4.1 * @see #setSubscriptionRegistry * @see DefaultSubscriptionRegistry#setPathMatcher @@ -140,6 +144,8 @@ private void initPathMatcherToUse() { * underlying SubscriptionRegistry, overriding any default there. *

With a standard {@link DefaultSubscriptionRegistry}, the default * cache limit is 1024. + *

Setting this property has no effect if the underlying SubscriptionRegistry + * is not an instance of {@link DefaultSubscriptionRegistry}. * @since 4.3.2 * @see #setSubscriptionRegistry * @see DefaultSubscriptionRegistry#setCacheLimit @@ -158,15 +164,18 @@ private void initCacheLimitToUse() { /** * Configure the name of a header that a subscription message can have for - * the purpose of filtering messages matched to the subscription. The header - * value is expected to be a Spring EL boolean expression to be applied to - * the headers of messages matched to the subscription. + * the purpose of filtering messages matched to the subscription. + *

The header value is expected to be a Spring Expression Language (SpEL) + * boolean expression to be applied to the headers of messages matched to the + * subscription. *

For example: - *

+	 * 
 	 * headers.foo == 'bar'
 	 * 
*

By default this is set to "selector". You can set it to a different * name, or to {@code null} to turn off support for a selector header. + *

Setting this property has no effect if the underlying SubscriptionRegistry + * is not an instance of {@link DefaultSubscriptionRegistry}. * @param selectorHeaderName the name to use for a selector header * @since 4.3.17 * @see #setSubscriptionRegistry diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java index 68e60f691b5a..fb2ece63ce65 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ * Registration class for configuring a {@link SimpleBrokerMessageHandler}. * * @author Rossen Stoyanchev + * @author Sam Brannen * @since 4.0 */ public class SimpleBrokerRegistration extends AbstractBrokerRegistration { @@ -81,11 +82,12 @@ public SimpleBrokerRegistration setHeartbeatValue(long[] heartbeat) { /** * Configure the name of a header that a subscription message can have for - * the purpose of filtering messages matched to the subscription. The header - * value is expected to be a Spring EL boolean expression to be applied to - * the headers of messages matched to the subscription. + * the purpose of filtering messages matched to the subscription. + *

The header value is expected to be a Spring Expression Language (SpEL) + * boolean expression to be applied to the headers of messages matched to the + * subscription. *

For example: - *

+	 * 
 	 * headers.foo == 'bar'
 	 * 
*

By default this is set to "selector". You can set it to a different