Add configuration for message buffer size limit

BufferingStompDecoder message buffer size limit can now be configured
with JavaConfig MessageBrokerRegistry.setMessageBufferSizeLimit() or
with XML <websocket:message-brocker message-buffer-size="">.

Issue: SPR-11527
This commit is contained in:
Sebastien Deleuze
2014-03-24 09:28:33 +01:00
committed by Rossen Stoyanchev
parent ebffd67b5e
commit bbdb72d808
14 changed files with 103 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -47,6 +47,8 @@ public class MessageBrokerRegistry {
private ChannelRegistration brokerChannelRegistration = new ChannelRegistration();
private Integer messageBufferSizeLimit;
public MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel) {
Assert.notNull(clientInboundChannel);
@@ -119,6 +121,22 @@ public class MessageBrokerRegistry {
return this.brokerChannelRegistration;
}
/**
* Configure the message buffer size limit in bytes.
* @since 4.0.3
*/
public MessageBrokerRegistry setMessageBufferSizeLimit(Integer messageBufferSizeLimit) {
this.messageBufferSizeLimit = messageBufferSizeLimit;
return this;
}
/**
* Get the message buffer size limit in bytes.
* @since 4.0.3
*/
public Integer getMessageBufferSizeLimit() {
return this.messageBufferSizeLimit;
}
protected SimpleBrokerMessageHandler getSimpleBroker(SubscribableChannel brokerChannel) {
if ((this.simpleBrokerRegistration == null) && (this.brokerRelayRegistration == null)) {

View File

@@ -31,7 +31,7 @@ import java.util.concurrent.LinkedBlockingQueue;
/**
* A an extension of {@link org.springframework.messaging.simp.stomp.StompDecoder}
* An extension of {@link org.springframework.messaging.simp.stomp.StompDecoder}
* that chunks any bytes remaining after a single full STOMP frame has been read.
* The remaining bytes may contain more STOMP frames or an incomplete STOMP frame.
*