You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pjotr <de...@gmx.net> on 2010/04/23 10:09:45 UTC

Message counter

Hi,

first of all I have to say I'm a beginner with ActiveMQ / Camel so please
have mercy on me 

I would like to store ActiveMQ messages in the filesystem with a specific
naming scheme [date]-[id]-[counter] 

Currently I got date and Id working - but I found no way to set a counter
:confused:

ActiveMQ 5.3 camel.xml:

...
<when>
<xpath>/event/qualifier = 'foo'</xpath>
<setHeader headerName="tmp_id"><xpath>/event/id</xpath></setHeader>
<to
uri="file://C:/tmp/?fileName=${date:now:yyyyMMddHHmmssSSS}-${in.headers.tmp_id}-${???}.xml"
/>
</when>
...

Any ideas??  
-- 
View this message in context: http://old.nabble.com/Message-counter-tp28337640p28337640.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Message counter

Posted by Pjotr <de...@gmx.net>.
Hi,

are there other possibilities with functions that directly come along with
Camel (ActiveMQ) ?

If not I'll do it that way you described it - but if it was possible to do
it with included functionality, I would prefer this. (Because I assume the
stability and reliability "out-of-the-box" is better, if there are less
dependencies... I guess...)

But thanks a lot for your fast response (and the good idea)!

Pjotr 


Claus Ibsen-2 wrote:
> 
> Hi
> 
> You can use a POJO/bean which returns the counter value. [...]
> 

-- 
View this message in context: http://old.nabble.com/Message-counter-tp28337640p28339878.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Message counter

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use a POJO/bean which returns the counter value.

See the last example here
http://camel.apache.org/file-language.html

Then all you do is defining your bean in spring

<bean id="myCounter" class="..."/>

And then you invoke the method on the bean, as shown in that last example.


On Fri, Apr 23, 2010 at 10:09 AM, Pjotr <de...@gmx.net> wrote:
>
> Hi,
>
> first of all I have to say I'm a beginner with ActiveMQ / Camel so please
> have mercy on me
>
> I would like to store ActiveMQ messages in the filesystem with a specific
> naming scheme [date]-[id]-[counter]
>
> Currently I got date and Id working - but I found no way to set a counter
> :confused:
>
> ActiveMQ 5.3 camel.xml:
>
> ...
> <when>
> <xpath>/event/qualifier = 'foo'</xpath>
> <setHeader headerName="tmp_id"><xpath>/event/id</xpath></setHeader>
> <to
> uri="file://C:/tmp/?fileName=${date:now:yyyyMMddHHmmssSSS}-${in.headers.tmp_id}-${???}.xml"
> />
> </when>
> ...
>
> Any ideas??
> --
> View this message in context: http://old.nabble.com/Message-counter-tp28337640p28337640.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus