Thanks Quin - worked like a charm!
What the recommended way to set the value on this bean?
What are the advantages/disadvantages of using groovy VS ${bean:..} syntax?
E.G.
<camel:script>
<camel:groovy>++execCount</camel:groovy>
</camel:script>
VS
<log id="logPreCheck"
message="${bean:execCount?method=sum($bean:execCount.longValue, 1)} " />
-----Original Message-----
From: Quinn Stevenson [mailto:[email protected]]
Sent: Wednesday, December 28, 2016 11:10 AM
To: [email protected]
Subject: Re: logging/incrementing simple counter
Try this
<log id="logPreCheck" message="Route enter: ${bean:execCount.longValue}" />
> On Dec 22, 2016, at 12:45 PM, Baltej Singh <[email protected]> wrote:
>
> Tring to create a simple counter to track some stats, not using the metrics
> related components.
> Just need to log execCount and do execCount++ everytime route is entered.
> What is the syntax for logging results of bean method?
> i.e. logging result of: <bean ref="execCount" method="longValue"/>
>
> Thanks,
> Baltej
>
> ---snippet----
> <bean class="java.lang.Long" id="execCount">
> <constructor-arg index="0" value="1" />
> </bean>
>
> <camelContext>
> <route id=" testIn">
>
> <from id="fileIn" uri="file:c:\test\in" />
> <log id="logPreCheck" message="Route enter: ${execCount.longValue}"
> />
> <log id="logPreCheck" message=" Route enter:
> {{execCount.longValue}}" />
> ...
> ...
>