The <endpoint/> element now expects a "handler" attribute instead of "handler-ref".

This commit is contained in:
Mark Fisher
2008-04-22 18:17:05 +00:00
parent cb3c4fbdc3
commit 4b01a3a09c
16 changed files with 31 additions and 31 deletions

View File

@@ -59,7 +59,7 @@ public class EndpointParser implements BeanDefinitionParser {
private static final String REF_ATTRIBUTE = "ref";
private static final String HANDLER_REF_ATTRIBUTE = "handler-ref";
private static final String HANDLER_ATTRIBUTE = "handler";
private static final String HANDLER_METHOD_ATTRIBUTE = "handler-method";
@@ -85,9 +85,9 @@ public class EndpointParser implements BeanDefinitionParser {
public BeanDefinition parse(Element element, ParserContext parserContext) {
String handlerRef = element.getAttribute(HANDLER_REF_ATTRIBUTE);
String handlerRef = element.getAttribute(HANDLER_ATTRIBUTE);
if (!StringUtils.hasText(handlerRef)) {
throw new ConfigurationException("The 'handler-ref' attribute is required.");
throw new ConfigurationException("The '" + HANDLER_ATTRIBUTE + "' attribute is required.");
}
RootBeanDefinition endpointDef = new RootBeanDefinition(HandlerEndpoint.class);
endpointDef.setSource(parserContext.extractSource(element));

View File

@@ -139,7 +139,7 @@
</xsd:sequence>
<xsd:attribute name="input-channel" type="xsd:string" use="required"/>
<xsd:attribute name="default-output-channel" type="xsd:string"/>
<xsd:attribute name="handler-ref" type="xsd:string" use="required"/>
<xsd:attribute name="handler" type="xsd:string" use="required"/>
<xsd:attribute name="handler-method" type="xsd:string"/>
<xsd:attribute name="error-handler" type="xsd:string"/>
<xsd:attribute name="reply-handler" type="xsd:string"/>

View File

@@ -11,11 +11,11 @@
<channel id="testChannel"/>
<endpoint id="defaultConcurrencyEndpoint" input-channel="testChannel" handler-ref="testHandler">
<endpoint id="defaultConcurrencyEndpoint" input-channel="testChannel" handler="testHandler">
<concurrency/>
</endpoint>
<endpoint id="configuredConcurrencyEndpoint" input-channel="testChannel" handler-ref="testHandler">
<endpoint id="configuredConcurrencyEndpoint" input-channel="testChannel" handler="testHandler">
<concurrency core="7" max="77" queue-capacity="777" keep-alive="7777"/>
</endpoint>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel"/>
<endpoint id="endpoint" input-channel="testChannel" handler-ref="testHandler" error-handler="errorHandler"/>
<endpoint id="endpoint" input-channel="testChannel" handler="testHandler" error-handler="errorHandler"/>
<beans:bean id="testHandler" class="org.springframework.integration.config.ExceptionThrowingTestHandler"/>

View File

@@ -19,7 +19,7 @@
<handler ref="handler3"/>
</handler-chain>
<endpoint input-channel="testChannel" handler-ref="chain" default-output-channel="replyChannel">
<endpoint input-channel="testChannel" handler="chain" default-output-channel="replyChannel">
<schedule period="100"/>
</endpoint>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel"/>
<endpoint id="endpoint" input-channel="testChannel" handler-ref="testHandler" reply-handler="replyHandler"/>
<endpoint id="endpoint" input-channel="testChannel" handler="testHandler" reply-handler="replyHandler"/>
<beans:bean id="testHandler" class="org.springframework.integration.config.TestHandler">
<beans:property name="replyMessageText" value="foo"/>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel" capacity="50"/>
<endpoint id="endpoint" input-channel="testChannel" handler-ref="testHandler">
<endpoint id="endpoint" input-channel="testChannel" handler="testHandler">
<schedule period="100"/>
<selector ref="typeSelector"/>
</endpoint>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel" capacity="50"/>
<endpoint input-channel="testChannel" handler-ref="testBean" handler-method="store">
<endpoint input-channel="testChannel" handler="testBean" handler-method="store">
<schedule period="100"/>
</endpoint>

View File

@@ -13,9 +13,9 @@
<channel id="channel"/>
<endpoint id="endpoint1" handler-ref="testHandler" input-channel="channel"/>
<endpoint id="endpoint1" handler="testHandler" input-channel="channel"/>
<endpoint id="endpoint2" handler-ref="testHandler" input-channel="channel">
<endpoint id="endpoint2" handler="testHandler" input-channel="channel">
<concurrency core="14" max="17"/>
</endpoint>

View File

@@ -11,7 +11,7 @@
<channel id="testChannel" capacity="50"/>
<endpoint input-channel="testChannel" handler-ref="testHandler">
<endpoint input-channel="testChannel" handler="testHandler">
<schedule period="100"/>
</endpoint>

View File

@@ -124,15 +124,15 @@
<section id="namespace-endpoint">
<title>Configuring Message Endpoints</title>
<para>
To create a Message Endpoint instance, use the 'endpoint' element with the 'input-channel' and 'handler-ref'
To create a Message Endpoint instance, use the 'endpoint' element with the 'input-channel' and 'handler'
attributes:
<programlisting>&lt;endpoint input-channel="exampleChannel" handler-ref="exampleHandler"/&gt;</programlisting>
<programlisting>&lt;endpoint input-channel="exampleChannel" handler="exampleHandler"/&gt;</programlisting>
</para>
<para>
The configuration above assumes that "exampleHandler" is an actual implementation of the
<interfacename>MessageHandler</interfacename> interface as described in <xref linkend="api-messagehandler"/>.
To delegate to an arbitrary method of any object, simply add the "handler-method" attribute.
<programlisting>&lt;endpoint input-channel="exampleChannel" handler-ref="somePojo" handler-method="someMethod"/&gt;</programlisting>
<programlisting>&lt;endpoint input-channel="exampleChannel" handler="somePojo" handler-method="someMethod"/&gt;</programlisting>
</para>
<para>
In either case (<interfacename>MessageHandler</interfacename> or arbitrary object/method), when the handling
@@ -146,7 +146,7 @@
neither is available, then a <classname>MessageHandlingException</classname> will be thrown. To configure the
default output channel when using the XML namespace, provide the 'default-output-channel' attribute:
<programlisting>&lt;endpoint input-channel="exampleChannel"
handler-ref="somePojo"
handler="somePojo"
handler-method="someMethod"
default-output-channel="replyChannel"/&gt;</programlisting>
</para>
@@ -154,7 +154,7 @@
Endpoint's also support <interfacename>MessageSelectors</interfacename> as described in
<xref linkend="api-messageselector"/>. To configure selectors with namespace support, simply add one or more
&lt;selector&gt; sub-elements to the endpoint definition:
<programlisting><![CDATA[<endpoint id="endpoint" input-channel="channel" handler-ref="handler">
<programlisting><![CDATA[<endpoint id="endpoint" input-channel="channel" handler="handler">
]]><emphasis><![CDATA[<selector ref="exampleSelector"/>]]></emphasis><![CDATA[
</endpoint>]]></programlisting>
</para>
@@ -164,7 +164,7 @@
endpoint subscriptions for its channel and delegates to a scheduler for managing the tasks that pull messages
from the channel and push them to the endpoints. To configure the polling period for an individual endpoint's
schedule, provide a 'schedule' sub-element with the 'period' in milliseconds:
<programlisting><![CDATA[<endpoint input-channel="exampleChannel" handler-ref="exampleHandler"/>
<programlisting><![CDATA[<endpoint input-channel="exampleChannel" handler="exampleHandler"/>
]]><emphasis><![CDATA[<schedule period="3000"/>]]></emphasis><![CDATA[
</endpoint>]]></programlisting>
</para>
@@ -182,7 +182,7 @@
consider (the other major factor being the expected volume on the channel to which the endpoint subscribes).
To enable concurrency for an endpoint that is configured with the XML namespace support, provide the
'concurrency' sub-element and one or more of the properties shown below:
<programlisting><![CDATA[<endpoint input-channel="exampleChannel" handler-ref="exampleHandler"/>
<programlisting><![CDATA[<endpoint input-channel="exampleChannel" handler="exampleHandler"/>
]]><emphasis><![CDATA[<concurrency core="5" max="25" queue-capacity="20" keep-alive="120"/>]]></emphasis><![CDATA[
</endpoint>]]></programlisting>
Recall the default concurrency policy values as listed in <xref linkend="api-messagebus-concurrencypolicy"/>.

View File

@@ -49,10 +49,10 @@
<channel id="coldDrinks"/>
<channel id="hotDrinks"/>
<endpoint input-channel="coldDrinks" handler-ref="barista"
<endpoint input-channel="coldDrinks" handler="barista"
handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler-ref="barista"
<endpoint input-channel="hotDrinks" handler="barista"
handler-method="prepareHotDrink"/>
<beans:bean id="cafe" class="org.springframework.integration.samples.cafe.Cafe">
@@ -163,9 +163,9 @@ public class Barista {
However, by configuring the endpoint concurrency, you can dramatically change the results. For example, on my
machine, the following single modification causes all 100 hot drinks to be prepared before the 4th cold drink is
ready:
<programlisting><![CDATA[<endpoint input-channel="coldDrinks" handler-ref="barista" handler-method="prepareColdDrink"/>
<programlisting><![CDATA[<endpoint input-channel="coldDrinks" handler="barista" handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler-ref="barista" handler-method="prepareHotDrink">
<endpoint input-channel="hotDrinks" handler="barista" handler-method="prepareHotDrink">
]]><emphasis><![CDATA[<concurrency core="25" max="50"/>]]></emphasis><![CDATA[
</endpoint>]]></programlisting>
</para>

View File

@@ -20,8 +20,8 @@
<channel id="coldDrinks"/>
<channel id="hotDrinks"/>
<endpoint input-channel="coldDrinks" handler-ref="barista" handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler-ref="barista" handler-method="prepareHotDrink"/>
<endpoint input-channel="coldDrinks" handler="barista" handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler="barista" handler-method="prepareHotDrink"/>
<beans:bean id="cafe" class="org.springframework.integration.samples.cafe.Cafe">
<beans:property name="orderChannel" ref="orders"/>

View File

@@ -20,8 +20,8 @@
<channel id="coldDrinks"/>
<channel id="hotDrinks"/>
<endpoint input-channel="coldDrinks" handler-ref="barista" handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler-ref="barista" handler-method="prepareHotDrink"/>
<endpoint input-channel="coldDrinks" handler="barista" handler-method="prepareColdDrink"/>
<endpoint input-channel="hotDrinks" handler="barista" handler-method="prepareHotDrink"/>
<beans:bean id="cafe" class="org.springframework.integration.samples.cafe.Cafe">
<beans:property name="orderChannel" ref="orders"/>

View File

@@ -19,7 +19,7 @@
channel="channel1" poll-period="10000"/>
<si:endpoint input-channel="channel1" default-output-channel="channel2"
handler-ref="exclaimer" handler-method="exclaim"/>
handler="exclaimer" handler-method="exclaim"/>
<si:file-target directory="${java.io.tmpdir}/spring-integration-samples/output"
channel="channel2"/>

View File

@@ -11,7 +11,7 @@
<endpoint input-channel="inputChannel"
default-output-channel="outputChannel"
handler-ref="helloService"
handler="helloService"
handler-method="sayHello"/>
<beans:bean id="helloService" class="org.springframework.integration.samples.helloworld.HelloService"/>