A splitter can be configured through XML as follows:
<channel id="inputChannel"/> <splitter id="splitter" ref="splitterBean" method="split" input-channel="inputChannel" output-channel="outputChannel" /> <channel id="outputChannel"/> <beans:bean id="splitterBean" class="sample.PojoSplitter"/>
The id of the splitter is optional. | |
A reference to a bean defined in the application context. The
bean must implement the splitting logic as described in the section
above. Optional.
If reference to a bean is not provided, then it is assumed that the payload of the Message that arrived on the | |
The method (defined on the bean specified above) that implements the splitting logic. Optional. | |
The input channel of the splitter. Required. | |
The channel where the splitter will send the results of splitting the incoming message. Optional (because incoming messages can specify a reply channel themselves). |
Using a "ref" attribute is generally recommended if the custom splitter handler implementation can be reused in other
<splitter>
definitions. However if the custom splitter handler implementation should be scoped to a
single definition of the <splitter>
, you can configure an inner bean definition:
<splitter id="testSplitter" input-channel="inChannel" method="split" output-channel="outChannel"> <beans:bean class="org.foo.TestSplitter"/> </spliter>
Note | |
---|---|
Using both a "ref" attribute and an inner handler definition in the same |