Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I loop in Apache Camel

<setHeader headerName="smsRecivers"><simple>{{reciversList}}</simple></setHeader>

I have a list mobile numbers(in comma separated form reciversList=999999999,88888888,799999999 ) and I have to send each a sms, looping through reciversList list

some thing like

<loop on="reciversList">
   // so some work
</loop>

I looked in to loop function it have a constant number.

like image 745
Nirbhay Mishra Avatar asked Oct 26 '25 20:10

Nirbhay Mishra


1 Answers

You can use loop : http://camel.apache.org/loop.html

<route>
  <setHeader headerName="smsRecivers">
     <simple>{{reciversList}}</simple>
  </setHeader>
  <loop>
    <simple>${in.header.smsRecivers.size}</simple>
    .....
  </loop>
</route>

Inside loop body you can get list's item by index, using excange property CamelLoopIndex or you can use custom increment index ( which can calculate in other header ).

like image 129
Alexey Yakunin Avatar answered Oct 29 '25 10:10

Alexey Yakunin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!