Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Jun 4, 2023
1 parent 9751987 commit d08e408
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
* @author Rossen Stoyanchev
* @author Sebastien Deleuze
* @author Juergen Hoeller
* @author Sam Brannen
* @since 4.0
*/
public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry {
Expand Down Expand Up @@ -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.
* <p>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.
* <p>For example:
* <pre>
* <pre style="code">
* headers.foo == 'bar'
* </pre>
* <p>By default this is set to "selector". You can set it to a different
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -97,11 +98,12 @@ public SimpleBrokerMessageHandler(SubscribableChannel clientInboundChannel, Mess


/**
* Configure a custom SubscriptionRegistry to use for storing subscriptions.
* <p><strong>Note</strong> 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.
* <p><strong>NOTE</strong>: 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");
Expand All @@ -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.
* <p>Default is a standard {@link org.springframework.util.AntPathMatcher}.
* <p>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
Expand All @@ -140,6 +144,8 @@ private void initPathMatcherToUse() {
* underlying SubscriptionRegistry, overriding any default there.
* <p>With a standard {@link DefaultSubscriptionRegistry}, the default
* cache limit is 1024.
* <p>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
Expand All @@ -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.
* <p>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.
* <p>For example:
* <pre>
* <pre style="code">
* headers.foo == 'bar'
* </pre>
* <p>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.
* <p>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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
* <p>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.
* <p>For example:
* <pre>
* <pre style="code">
* headers.foo == 'bar'
* </pre>
* <p>By default this is set to "selector". You can set it to a different
Expand Down

0 comments on commit d08e408

Please sign in to comment.