Added 'dispatcher-pool-size' attribute to the 'message-bus' element, and fixed namespace support for 'schedule' and 'concurrency' on endpoints.

This commit is contained in:
Mark Fisher
2008-01-19 01:43:55 +00:00
parent 7c95ef7634
commit 6bee7a9997
2 changed files with 13 additions and 7 deletions

View File

@@ -78,6 +78,8 @@ public class EndpointParser implements BeanDefinitionParser {
private static final String PERIOD_ATTRIBUTE = "period";
private static final String SCHEDULE_ELEMENT = "schedule";
private static final String SCHEDULE_PROPERTY = "schedule";
private static final String CONCURRENCY_ELEMENT = "concurrency";
@@ -108,13 +110,16 @@ public class EndpointParser implements BeanDefinitionParser {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String localName = child.getLocalName();
if (CONCURRENCY_ELEMENT.equals(localName)) {
parseConcurrencyPolicy((Element) child, subscriptionDef);
parseConcurrencyPolicy((Element) child, endpointDef);
}
else if (HANDLER_ELEMENT.equals(localName)) {
String ref = ((Element) child).getAttribute(REF_ATTRIBUTE);
String method = ((Element) child).getAttribute(METHOD_ATTRIBUTE);
childHandlerRefs.add(this.parseHandlerAdapter(ref, method, parserContext));
}
else if (SCHEDULE_ELEMENT.equals(localName)) {
this.parseSchedule((Element) child, subscriptionDef);
}
}
}
String subscriptionBeanName = parserContext.getReaderContext().generateBeanName(subscriptionDef);
@@ -160,7 +165,7 @@ public class EndpointParser implements BeanDefinitionParser {
return endpointDef;
}
private void parseConcurrencyPolicy(Element concurrencyElement, RootBeanDefinition subscriptionDefinition) {
private void parseConcurrencyPolicy(Element concurrencyElement, RootBeanDefinition endpointDef) {
ConcurrencyPolicy policy = new ConcurrencyPolicy();
String coreSize = concurrencyElement.getAttribute(CORE_SIZE_ATTRIBUTE);
String maxSize = concurrencyElement.getAttribute(MAX_SIZE_ATTRIBUTE);
@@ -170,16 +175,16 @@ public class EndpointParser implements BeanDefinitionParser {
if (StringUtils.hasText(maxSize)) {
policy.setMaxSize(Integer.parseInt(maxSize));
}
subscriptionDefinition.getPropertyValues().addPropertyValue(CONCURRENCY_POLICY_PROPERTY, policy);
endpointDef.getPropertyValues().addPropertyValue(CONCURRENCY_POLICY_PROPERTY, policy);
}
private void parseSchedule(Element scheduleElement, RootBeanDefinition endpointDefinition) {
private void parseSchedule(Element scheduleElement, RootBeanDefinition subscriptionDef) {
PollingSchedule schedule = new PollingSchedule(5);
String period = scheduleElement.getAttribute(PERIOD_ATTRIBUTE);
if (StringUtils.hasText(period)) {
schedule.setPeriod(Integer.parseInt(period));
}
endpointDefinition.getPropertyValues().addPropertyValue(SCHEDULE_PROPERTY, schedule);
subscriptionDef.getPropertyValues().addPropertyValue(SCHEDULE_PROPERTY, schedule);
}
private String parseHandlerAdapter(String handlerRef, String handlerMethod, ParserContext parserContext) {

View File

@@ -26,6 +26,7 @@
</xsd:annotation>
<xsd:attribute name="auto-create-channels" type="xsd:boolean"/>
<xsd:attribute name="error-channel" type="xsd:string"/>
<xsd:attribute name="dispatcher-pool-size" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
@@ -101,7 +102,7 @@
<xsd:extension base="beans:identifiedType">
<xsd:sequence>
<xsd:element ref="schedule" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="concurrency-policy" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="concurrency" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="handler" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="input-channel" type="xsd:string"/>
@@ -124,7 +125,7 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="concurrency-policy">
<xsd:element name="concurrency">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>