INT-625 initial commit of namespace support for 'task-executor' on the <channel/> element
This commit is contained in:
@@ -41,6 +41,8 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
protected BeanDefinitionBuilder buildBeanDefinition(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = null;
|
||||
Element queueElement = null;
|
||||
|
||||
// configure a queue-based channel if any queue sub-element is defined
|
||||
if ((queueElement = DomUtils.getChildElementByTagName(element, "queue")) != null) {
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".QueueChannel");
|
||||
boolean hasCapacity = this.parseQueueCapacity(builder, queueElement);
|
||||
@@ -61,8 +63,24 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
else if ((queueElement = DomUtils.getChildElementByTagName(element, "rendezvous-queue")) != null) {
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".RendezvousChannel");
|
||||
}
|
||||
else {
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".DirectChannel");
|
||||
|
||||
// verify that the 'task-executor' is not provided if a queue sub-element exists
|
||||
String taskExecutor = element.getAttribute("task-executor");
|
||||
if (queueElement != null && StringUtils.hasText(taskExecutor)) {
|
||||
parserContext.getReaderContext().error("The 'task-executor' attribute " +
|
||||
"and any queue sub-element are mutually exclusive.", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (builder == null) {
|
||||
// configure either an ExecutorChannel or DirectChannel based on existence of 'task-executor'
|
||||
if (StringUtils.hasText(taskExecutor)) {
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".ExecutorChannel");
|
||||
builder.addConstructorArgReference(taskExecutor);
|
||||
}
|
||||
else {
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(CHANNEL_PACKAGE + ".DirectChannel");
|
||||
}
|
||||
parseDispatcher(element.getAttribute("dispatcher"), builder, parserContext);
|
||||
}
|
||||
return builder;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<xsd:element name="channel">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines a Point-to-Point MessageChannel.
|
||||
Defines a Point-to-Point MessageChannel.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
@@ -66,6 +66,21 @@
|
||||
<xsd:element name="interceptors" type="channelInterceptorsType"
|
||||
minOccurs="0" maxOccurs="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="task-executor" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Provide a TaskExecutor to use when dispatching Messages to this channel's subscribers. This is
|
||||
mutually exclusive with any of the queue sub-elements. Also, when using a TaskExecutor, keep in
|
||||
mind that any transaction active for the sender will NOT propagate to the handler invocation
|
||||
since the TaskExecutor dispatches to the handler on a separate Thread.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.core.task.TaskExecutor" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
Reference in New Issue
Block a user