camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <qu...@pronoia-solutions.com>
Subject Re: logging/incrementing simple counter
Date Fri, 30 Dec 2016 17:04:53 GMT
Can you be a little more specific on how it isn’t working?  I tried a simplified form of
your file uri, and it seemed to work fine.

<route>
    <from uri="file:target/data?move=done/${bean:inboundCounter.incrementAndGet}-finished.txt"/>
    <to uri="mock://complete" />
</route>

> On Dec 29, 2016, at 5:42 PM, Baltej Singh <bsingh@ra.rockwell.com> wrote:
> 
> Quinn,
> 
> Works great  on its own, but not in the file components move attribute!
>          <from id="_id2" uri="file:{{in.path}}?moveFailed=.failed/$simple{file:onlyname}&amp;move={{archive-from-erp.path}}/${bean:inboundCounter.incrementAndGet}-{{common.fname.pattern}}"/>
> 
> 
> -----Original Message-----
> From: Quinn Stevenson [mailto:quinn@pronoia-solutions.com] 
> Sent: Thursday, December 29, 2016 2:36 PM
> To: users@camel.apache.org
> Subject: Re: logging/incrementing simple counter
> 
> I’d probably use and AtomicLong for this specific use case
> 
> <bean id="execCounter" class="java.util.concurrent.atomic.AtomicLong" />
> 
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>    <route>
>        <from uri="direct://trigger" />
>        <log message="Exec Counter: ${bean:execCounter.incrementAndGet}" />
>    </route>
> </camelContext>
> 
>> On Dec 29, 2016, at 2:49 PM, Baltej Singh <bsingh@ra.rockwell.com> wrote:
>> 
>> Following code works, but is there a better way to define the constant 1L in Spring
DSL Camel context?
>> 
>> 	<bean class="java.lang.Long" id="longOne">
>> 		<constructor-arg index="0" value="1" />
>> 	</bean>
>> 	<bean class="java.lang.Long" id="execCount">
>> 		<constructor-arg index="0" value="1" />
>> 	</bean>
>> 
>> 
>> 	<log id="_id1"   message="${bean:execCount?method=sum(${bean:execCount.longValue},
${bean:longOne.longValue})}" />
>> 
>> 
>> 
>> -----Original Message-----
>> From: Baltej Singh 
>> Sent: Thursday, December 29, 2016 12:08 PM
>> To: users@camel.apache.org
>> Subject: RE: logging/incrementing simple counter
>> 
>> 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?
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message