title: Spring Integration - Scheduling Job from configuration file
body: <p>I'm using Spring Integration to parse XML file and i will need to create a thread (and each one have a different rate) for each tag.</p>
  
  <p>Right now (with the help of many users here :)) i'm able to split XML by tag and then route it to the appropiate <code>service-activator</code>.</p>
  
  <p>This works great but i'm not able to redirect to a channel that create "a thread" and then execute the operations. Right now i have the following configuration and in my mind (that i dont know if it is correct...)</p>
  
  <pre><code>Split tag -&gt; Route to the appropiate channel -&gt; Start a thread(from tag configuration) -&gt; Execute the operation
  </code></pre>
  
  <p>This is my actual configuration that split tag and redirect to the channel.
  The router should redirect not toward a channel directly, but schedule them.</p>
  
  <p>In first instance will be enought to redirect it in a pool with fixed rate and later i will use XPATH to get the attribute and then replace this "fixed" rate with the correct value.</p>
  
  <p>I've tried many solutions to create this flow but each one fails or do not compile :(</p>
  
  <pre><code>&lt;context:component-scan base-package="it.mypkg" /&gt;
  
  &lt;si:channel id="rootChannel" /&gt;
  
  &lt;si-xml:xpath-splitter id="mySplitter" input-channel="rootChannel" output-channel="routerChannel" create-documents="true"&gt;
      &lt;si-xml:xpath-expression expression="//service" /&gt;
  &lt;/si-xml:xpath-splitter&gt;
  
  &lt;si-xml:xpath-router id="router" input-channel="routerChannel" evaluate-as-string="true"&gt;
      &lt;si-xml:xpath-expression expression="concat(name(./node()), 'Channel')" /&gt;
  &lt;/si-xml:xpath-router&gt;
  
  &lt;si:service-activator input-channel="serviceChannel" output-channel="endChannel"&gt;
      &lt;bean class="it.mypkg.Service" /&gt;
  &lt;/si:service-activator&gt;
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  Using this configuration for the <code>service</code> this should run a task every 10 seconds (the <code>id=service1</code>) and every 5 seconds the other (the <code>id=service2</code>). In the same way i can have another tag that is handle by another class (because this will have another behaviour)</p>
  
  <pre><code>&lt;root&gt;
      &lt;service id="service1" interval="10000" /&gt;
      &lt;service id="service2" interval="5000" /&gt;
      &lt;activity id="activity1" interval="50000" /&gt;
  &lt;root&gt;
  </code></pre>
  
  <p>I will have a classe (<code>Service</code>) that is general to handle Service tag and this complete some operation and then "return me" the value so i can redirect to another channel.</p>
  
  <pre><code>public class Service {
      public int execute() {
          // Execute the task and return the value to continue the "chain"
      }
  }
  </code></pre>