summaryrefslogtreecommitdiff
path: root/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java
diff options
context:
space:
mode:
Diffstat (limited to 'spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java')
-rw-r--r--spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java38
1 files changed, 27 insertions, 11 deletions
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java
index 1eabf8fd..3c8dd759 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2015 the original author or authors.
+ * Copyright 2002-2016 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.
@@ -51,6 +51,8 @@ public class MessageBrokerRegistry {
private PathMatcher pathMatcher;
+ private Integer cacheLimit;
+
public MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel) {
Assert.notNull(clientInboundChannel);
@@ -96,6 +98,16 @@ public class MessageBrokerRegistry {
return this.brokerChannelRegistration;
}
+ protected String getUserDestinationBroadcast() {
+ return (this.brokerRelayRegistration != null ?
+ this.brokerRelayRegistration.getUserDestinationBroadcast() : null);
+ }
+
+ protected String getUserRegistryBroadcast() {
+ return (this.brokerRelayRegistration != null ?
+ this.brokerRelayRegistration.getUserRegistryBroadcast() : null);
+ }
+
/**
* Configure one or more prefixes to filter destinations targeting application
* annotated methods. For example destinations prefixed with "/app" may be
@@ -137,16 +149,6 @@ public class MessageBrokerRegistry {
return this.userDestinationPrefix;
}
- protected String getUserDestinationBroadcast() {
- return (this.brokerRelayRegistration != null ?
- this.brokerRelayRegistration.getUserDestinationBroadcast() : null);
- }
-
- protected String getUserRegistryBroadcast() {
- return (this.brokerRelayRegistration != null ?
- this.brokerRelayRegistration.getUserRegistryBroadcast() : null);
- }
-
/**
* Configure the PathMatcher to use to match the destinations of incoming
* messages to {@code @MessageMapping} and {@code @SubscribeMapping} methods.
@@ -162,6 +164,7 @@ public class MessageBrokerRegistry {
* <p>When the simple broker is enabled, the PathMatcher configured here is
* also used to match message destinations when brokering messages.
* @since 4.1
+ * @see org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry#setPathMatcher
*/
public MessageBrokerRegistry setPathMatcher(PathMatcher pathMatcher) {
this.pathMatcher = pathMatcher;
@@ -172,6 +175,18 @@ public class MessageBrokerRegistry {
return this.pathMatcher;
}
+ /**
+ * Configure the cache limit to apply for registrations with the broker.
+ * <p>This is currently only applied for the destination cache in the
+ * subscription registry. The default cache limit there is 1024.
+ * @since 4.3.2
+ * @see org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry#setCacheLimit
+ */
+ public MessageBrokerRegistry setCacheLimit(int cacheLimit) {
+ this.cacheLimit = cacheLimit;
+ return this;
+ }
+
protected SimpleBrokerMessageHandler getSimpleBroker(SubscribableChannel brokerChannel) {
if (this.simpleBrokerRegistration == null && this.brokerRelayRegistration == null) {
@@ -180,6 +195,7 @@ public class MessageBrokerRegistry {
if (this.simpleBrokerRegistration != null) {
SimpleBrokerMessageHandler handler = this.simpleBrokerRegistration.getMessageHandler(brokerChannel);
handler.setPathMatcher(this.pathMatcher);
+ handler.setCacheLimit(this.cacheLimit);
return handler;
}
return null;