Spring Integration - Scheduling Job from configuration file -


i'm using spring integration parse xml file , need create thread (and each 1 have different rate) each tag.

right (with of many users here :)) i'm able split xml tag , route appropiate service-activator.

this works great i'm not able redirect channel create "a thread" , execute operations. right have following configuration , in mind (that dont know if correct...)

split tag -> route appropiate channel -> start thread(from tag configuration) -> execute operation 

this actual configuration split tag , redirect channel. router should redirect not toward channel directly, schedule them.

in first instance enought redirect in pool fixed rate , later use xpath attribute , replace "fixed" rate correct value.

i've tried many solutions create flow each 1 fails or not compile :(

<context:component-scan base-package="it.mypkg" />  <si:channel id="rootchannel" />  <si-xml:xpath-splitter id="mysplitter" input-channel="rootchannel" output-channel="routerchannel" create-documents="true">     <si-xml:xpath-expression expression="//service" /> </si-xml:xpath-splitter>  <si-xml:xpath-router id="router" input-channel="routerchannel" evaluate-as-string="true">     <si-xml:xpath-expression expression="concat(name(./node()), 'channel')" /> </si-xml:xpath-router>  <si:service-activator input-channel="servicechannel" output-channel="endchannel">     <bean class="it.mypkg.service" /> </si:service-activator> 

update: using configuration service should run task every 10 seconds (the id=service1) , every 5 seconds other (the id=service2). in same way can have tag handle class (because have behaviour)

<root>     <service id="service1" interval="10000" />     <service id="service2" interval="5000" />     <activity id="activity1" interval="50000" /> <root> 

i have classe (service) general handle service tag , complete operation , "return me" value can redirect channel.

public class service {     public int execute() {         // execute task , return value continue "chain"     } } 

it's not @ clear mean; split tag; route want "schedule" @ rate in xml. it's not clear mean "schedule" here - each message processed once not multiple times on schedule.

as said, don't understand need do, smart poller might suitable.

another possibility delayer amount of delay can derived message.

edit

since "services" don't seem take input data, looks need configure/start <inbound-channel-adapter/> each service, , start it, based on arguments in xml.

<int:inbound-channel-adapter id="service1" channel="foo"             auto-startup="false"             ref="service1bean" method="execute">      <poller fixed-delay="1000" /> </int:inbound-channel-adapter/> 

note auto-startup="false".

now, in code receives split

@autowired sourcepollingchanneladapter service1;  ...  public void startservice1(node node) {      ...      service1.settrigger(new peridictrigger(...));      service1.start();      ... } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -