INT-3006: Resolve 'maxSubscribers' from INT Props
JIRA: https://jira.springsource.org/browse/INT-3006 * Add integration properties `channels.maxUnicastSubscribers` and `channels.maxBroadcastSubscribers` with default value to `Integer.MAX_VALUE` * Add SpEL value resolution for those default values from parsers * Deprecate similar properties from `ChannelInitializer` INT-3006 `maxSubscribers` from channels' onInit() * Move default init for `maxSubscribers` to the channels' `onInit()` from `integrationProperties`, not from parsers * extract `default` `integrationProperties` from static block in the `IntegrationProperties` and use them as `default` on `IntegrationContextUtils#getIntegrationProperties` * Add bean definition expression building to get the default values for `integration properties` on bean building phase. INT-3006: Add `taskScheduler.poolSize` property INT-3006: Polishing
This commit is contained in:
committed by
Gary Russell
parent
14c966c1fa
commit
db32486d35
@@ -26,6 +26,7 @@ import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageDeliveryException;
|
||||
import org.springframework.integration.MessageDispatchingException;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.context.IntegrationProperties;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.integration.dispatcher.AbstractDispatcher;
|
||||
@@ -51,7 +52,7 @@ public class SubscribableJmsChannel extends AbstractJmsChannel implements Subscr
|
||||
|
||||
private volatile boolean initialized;
|
||||
|
||||
private volatile int maxSubscribers = Integer.MAX_VALUE;
|
||||
private volatile Integer maxSubscribers;
|
||||
|
||||
public SubscribableJmsChannel(AbstractMessageListenerContainer container, JmsTemplate jmsTemplate) {
|
||||
super(jmsTemplate);
|
||||
@@ -105,6 +106,12 @@ public class SubscribableJmsChannel extends AbstractJmsChannel implements Subscr
|
||||
unicastingDispatcher.setLoadBalancingStrategy(new RoundRobinLoadBalancingStrategy());
|
||||
this.dispatcher = unicastingDispatcher;
|
||||
}
|
||||
if (this.maxSubscribers == null) {
|
||||
this.maxSubscribers = this.getIntegrationProperty(isPubSub ?
|
||||
IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS :
|
||||
IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS,
|
||||
Integer.class);
|
||||
}
|
||||
this.dispatcher.setMaxSubscribers(this.maxSubscribers);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,13 @@ package org.springframework.integration.jms.config;
|
||||
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractChannelParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Parser for the 'channel' and 'publish-subscribe-channel' elements of the
|
||||
@@ -58,12 +59,13 @@ public class JmsChannelParser extends AbstractChannelParser {
|
||||
builder.addPropertyReference("connectionFactory", connectionFactory);
|
||||
if ("channel".equals(element.getLocalName())) {
|
||||
this.parseDestination(element, parserContext, builder, "queue");
|
||||
this.setMaxSubscribersProperty(parserContext, builder, element, IntegrationNamespaceUtils.DEFAULT_MAX_UNICAST_SUBSCRIBERS_PROPERTY_NAME);
|
||||
}
|
||||
else if ("publish-subscribe-channel".equals(element.getLocalName())) {
|
||||
this.parseDestination(element, parserContext, builder, "topic");
|
||||
this.setMaxSubscribersProperty(parserContext, builder, element, IntegrationNamespaceUtils.DEFAULT_MAX_BROADCAST_SUBSCRIBERS_PROPERTY_NAME);
|
||||
}
|
||||
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-subscribers");
|
||||
|
||||
String containerType = element.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
||||
String containerClass = element.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
||||
if (!StringUtils.hasText(containerClass)) {
|
||||
|
||||
Reference in New Issue
Block a user