Skip to content

Commit d08e408

Browse files
committed
Polishing
1 parent 9751987 commit d08e408

File tree

3 files changed

+34
-20
lines changed

3 files changed

+34
-20
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
* @author Rossen Stoyanchev
6262
* @author Sebastien Deleuze
6363
* @author Juergen Hoeller
64+
* @author Sam Brannen
6465
* @since 4.0
6566
*/
6667
public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
@@ -121,11 +122,12 @@ public int getCacheLimit() {
121122

122123
/**
123124
* Configure the name of a header that a subscription message can have for
124-
* the purpose of filtering messages matched to the subscription. The header
125-
* value is expected to be a Spring EL boolean expression to be applied to
126-
* the headers of messages matched to the subscription.
125+
* the purpose of filtering messages matched to the subscription.
126+
* <p>The header value is expected to be a Spring Expression Language (SpEL)
127+
* boolean expression to be applied to the headers of messages matched to the
128+
* subscription.
127129
* <p>For example:
128-
* <pre>
130+
* <pre style="code">
129131
* headers.foo == 'bar'
130132
* </pre>
131133
* <p>By default this is set to "selector". You can set it to a different
@@ -138,8 +140,9 @@ public void setSelectorHeaderName(@Nullable String selectorHeaderName) {
138140
}
139141

140142
/**
141-
* Return the name for the selector header name.
143+
* Return the name of the selector header.
142144
* @since 4.2
145+
* @see #setSelectorHeaderName(String)
143146
*/
144147
@Nullable
145148
public String getSelectorHeaderName() {

spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
/**
4343
* A "simple" message broker that recognizes the message types defined in
4444
* {@link SimpMessageType}, keeps track of subscriptions with the help of a
45-
* {@link SubscriptionRegistry} and sends messages to subscribers.
45+
* {@link SubscriptionRegistry}, and sends messages to subscribers.
4646
*
4747
* @author Rossen Stoyanchev
4848
* @author Juergen Hoeller
49+
* @author Sam Brannen
4950
* @since 4.0
5051
*/
5152
public class SimpleBrokerMessageHandler extends AbstractBrokerMessageHandler {
@@ -97,11 +98,12 @@ public SimpleBrokerMessageHandler(SubscribableChannel clientInboundChannel, Mess
9798

9899

99100
/**
100-
* Configure a custom SubscriptionRegistry to use for storing subscriptions.
101-
* <p><strong>Note</strong> that when a custom PathMatcher is configured via
102-
* {@link #setPathMatcher}, if the custom registry is not an instance of
103-
* {@link DefaultSubscriptionRegistry}, the provided PathMatcher is not used
104-
* and must be configured directly on the custom registry.
101+
* Configure a custom {@link SubscriptionRegistry} to use for storing subscriptions.
102+
* <p><strong>NOTE</strong>: If the custom registry is not an instance of
103+
* {@link DefaultSubscriptionRegistry}, the configured {@link #setPathMatcher
104+
* PathMatcher}, {@linkplain #setCacheLimit cache limit}, and
105+
* {@linkplain #setSelectorHeaderName selector header name} are not used and
106+
* must be configured directly on the custom registry.
105107
*/
106108
public void setSubscriptionRegistry(SubscriptionRegistry subscriptionRegistry) {
107109
Assert.notNull(subscriptionRegistry, "SubscriptionRegistry must not be null");
@@ -119,6 +121,8 @@ public SubscriptionRegistry getSubscriptionRegistry() {
119121
* When configured, the given PathMatcher is passed down to the underlying
120122
* SubscriptionRegistry to use for matching destination to subscriptions.
121123
* <p>Default is a standard {@link org.springframework.util.AntPathMatcher}.
124+
* <p>Setting this property has no effect if the underlying SubscriptionRegistry
125+
* is not an instance of {@link DefaultSubscriptionRegistry}.
122126
* @since 4.1
123127
* @see #setSubscriptionRegistry
124128
* @see DefaultSubscriptionRegistry#setPathMatcher
@@ -140,6 +144,8 @@ private void initPathMatcherToUse() {
140144
* underlying SubscriptionRegistry, overriding any default there.
141145
* <p>With a standard {@link DefaultSubscriptionRegistry}, the default
142146
* cache limit is 1024.
147+
* <p>Setting this property has no effect if the underlying SubscriptionRegistry
148+
* is not an instance of {@link DefaultSubscriptionRegistry}.
143149
* @since 4.3.2
144150
* @see #setSubscriptionRegistry
145151
* @see DefaultSubscriptionRegistry#setCacheLimit
@@ -158,15 +164,18 @@ private void initCacheLimitToUse() {
158164

159165
/**
160166
* Configure the name of a header that a subscription message can have for
161-
* the purpose of filtering messages matched to the subscription. The header
162-
* value is expected to be a Spring EL boolean expression to be applied to
163-
* the headers of messages matched to the subscription.
167+
* the purpose of filtering messages matched to the subscription.
168+
* <p>The header value is expected to be a Spring Expression Language (SpEL)
169+
* boolean expression to be applied to the headers of messages matched to the
170+
* subscription.
164171
* <p>For example:
165-
* <pre>
172+
* <pre style="code">
166173
* headers.foo == 'bar'
167174
* </pre>
168175
* <p>By default this is set to "selector". You can set it to a different
169176
* name, or to {@code null} to turn off support for a selector header.
177+
* <p>Setting this property has no effect if the underlying SubscriptionRegistry
178+
* is not an instance of {@link DefaultSubscriptionRegistry}.
170179
* @param selectorHeaderName the name to use for a selector header
171180
* @since 4.3.17
172181
* @see #setSubscriptionRegistry

spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
2626
* Registration class for configuring a {@link SimpleBrokerMessageHandler}.
2727
*
2828
* @author Rossen Stoyanchev
29+
* @author Sam Brannen
2930
* @since 4.0
3031
*/
3132
public class SimpleBrokerRegistration extends AbstractBrokerRegistration {
@@ -81,11 +82,12 @@ public SimpleBrokerRegistration setHeartbeatValue(long[] heartbeat) {
8182

8283
/**
8384
* Configure the name of a header that a subscription message can have for
84-
* the purpose of filtering messages matched to the subscription. The header
85-
* value is expected to be a Spring EL boolean expression to be applied to
86-
* the headers of messages matched to the subscription.
85+
* the purpose of filtering messages matched to the subscription.
86+
* <p>The header value is expected to be a Spring Expression Language (SpEL)
87+
* boolean expression to be applied to the headers of messages matched to the
88+
* subscription.
8789
* <p>For example:
88-
* <pre>
90+
* <pre style="code">
8991
* headers.foo == 'bar'
9092
* </pre>
9193
* <p>By default this is set to "selector". You can set it to a different

0 commit comments

Comments
 (0)