camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Writing to destination where priority is based on filename extension
Date Tue, 29 Nov 2011 15:39:24 GMT
Hi

There is also the resequencer EIP which can be used to re-order messages.

There is a file name based example with the stream resequencer
http://camel.apache.org/resequencer



On Tue, Nov 29, 2011 at 4:36 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> Ah you can use a custom comparator for the sort. See the _sorting
> using comparator_ section at
> http://camel.apache.org/file2
>
> The sortBy=*.pdf;*.txt would not work as expected. We could possible
> enhance this, so Camel will fallback on using a regular expression on
> the file name, if you do not use any of the ${file} tokens.
>
>
> On Tue, Nov 29, 2011 at 9:24 AM, Lars <lars.stuevold@ergogroup.no> wrote:
>> Hi,
>>
>> I have the following route below which transfers pdf-files and txt-files
>> from one directory to different directories at target system. I want to
>> write the pdf-files to target system before txt-files.
>> I tried to do this by using sortBy in property file.
>> Like this:
>> sftp.inbox=sftp://comp@xxx.xxx.xxx.xxx:22/files?password=secret&sortBy=*.pdf;*.txt
>>
>> However, it seems that some of the pdf-files is written to target after the
>> txt-file.
>> Are there other configurations to use to achieve that txt-files will be
>> written to target system after all pdf-files?
>> I'm using Camel 2.8.2.
>>
>>
>> <route id="inComingInvoiceRoute" routePolicyRef="incomingPolicy" >
>>        <from uri="{{sftp.inbox}}" />
>>        <choice>
>>                <when>
>>                        <language language="simple">${header.CamelFileNameOnly}
regex
>> '^.*pdf$'</language>
>>                        <to uri="{{file.imagedirectory}}" />
>>                </when>
>>                <when>
>>                        <language language="simple">${header.CamelFileNameOnly}
regex
>> '^.*txt$'</language>
>>                        <to uri="{{file.outbox}}" />
>>                </when>
>>                <otherwise>
>>                        <to uri="{{file.other}}" />
>>                </otherwise>
>>        </choice>
>> </route>
>>
>>
>> Thanks in advance for any hints.
>>
>> Best regards
>> Lars Stuevold
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Writing-to-destination-where-priority-is-based-on-filename-extension-tp5031542p5031542.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message