On Fri, Feb 22, 2013 at 10:55 PM, Mark Lawson <ma...@emconnect.com> wrote:
> Hi,
>
> I'm getting some temperature readings from a 1-wire system and putting them
> out on an mqtt broker with Camel 2.10.3. The readings appear in the file
> system as /mnt/1wire/study/temperature etc and I'm using this route:
>
>
>
> It works fine but I wanted to be able to choose different mqtt sub-topics
> based on the sensor position, so study temperatures to measure/study,
> kitchen to measure/kitchen etc. Is there a way to do this? I can see that
> file:parent will give me the whole path, but I can't see a way to split it
> to get the last value. Is it possible with <simple/> ?
>
> I appreciate that I might just be pushing the whole Spring XML idiom too far
> and I need some pojo or other.
>

The Camel file component adds a number of headers with file
information. If you look at those headers there may be a file name
only, file path only etc.

And if you want the parent dir name only, maybe you need to work with
some regular expression magic, or use some of the expression languages
like groovy where you can do more powerful stuff.

And as always you can bit the bullet and implement a little java
method that extracts the path you need. And call this method from the
spring xml.

>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Get-last-file-folder-in-header-tp5728048.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to