Hi,

At the beginning of the route you are setting the header to the value a has 
when the route is started (it's a constant expression). In the processor you 
are incrementing the value and are then setting the header to the current value 
of the variable a, so the route behaves as one would expect.

Best regards
Stephan

-----Original Message-----
From: Kasim Sert (Ibtech-Software Infrastructure) 
[mailto:kasim.s...@ibtech.com.tr] 
Sent: Mittwoch, 13. April 2016 10:52
To: users@camel.apache.org
Subject: Changing header value

Hi,

Can somebody please explain, why header value for starting always remains same 
although its changed in processor ?

Route:
İnt a=1
from("timer://myTimer2?period=1000")
                             .setHeader("myheader", constant(a))
                             .log("starting...${header[myheader]}")
                             .process(new Processor() {
                                   @Override
                                   public void process(Exchange exchange) 
throws Exception {
                                         a = a+1 ;
                                         exchange.getIn().setHeader("myheader", 
constant(a));
                                         Thread.sleep(10000);
                                   }
                             })
                             .log("ending...${header[myheader]}");


Log produced:

2016-04-13 11:45:47,894 [imer://myTimer2] INFO  route1                         
- starting...1
2016-04-13 11:45:57,899 [imer://myTimer2] INFO  route1                         
- ending...2
2016-04-13 11:45:57,900 [imer://myTimer2] INFO  route1                         
- starting...1
2016-04-13 11:46:07,900 [imer://myTimer2] INFO  route1                         
- ending...3
2016-04-13 11:46:07,900 [imer://myTimer2] INFO  route1                         
- starting...1
2016-04-13 11:46:17,901 [imer://myTimer2] INFO  route1                         
- ending...4



[Facebook]<http://www.facebook.com/Finansbank>  [Twitter] 
<http://twitter.com/finansbank>

[https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=13.04.201611:5100]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=13.04.201611:5100>


Bu e-posta'nın içerdiği bilgiler (ekleri dahil olmak üzere) gizlidir. Onayımız 
olmaksızın üçüncü kişilere açiklanamaz. Bu mesajın gönderilmek istendiği kişi 
değilseniz, lütfen mesajı sisteminizden derhal siliniz. IBTech A.Ş. bu mesajın 
içerdiği bilgilerin doğruluğu veya eksiksiz olduğu konusunda bir garanti 
vermemektedir. Bu nedenle bilgilerin ne şekilde olursa olsun içeriğinden, 
iletilmesinden, alınmasından, saklanmasından sorumlu değildir. Bu mesajın 
içeriği yazarına ait olup, IBTech A.Ş.'nin görüşlerini içermeyebilir.

The information contained in this e-mail (including any attachments)is 
confidential. It must not be disclosed to any person without our authority. If 
you are not the intended recipient, please delete it from your system 
immediately. IBTech A.S. makes no warranty as to the accuracy or completeness 
of any information contained in this message and hereby excludes any liability 
of any kind for the information contained therein or for the information 
transmission, reception, storage or use of such in any way whatsoever. Any 
opinions expressed in this message are those of the author and may not 
necessarily reflect the opinions of IBTech A.S.

Reply via email to