On Thu, Dec 3, 2009 at 5:47 PM, boden <[email protected]> wrote:
>
> I need to watch a folder for incoming binary files.  When one appears, I need
> to examine it to determine where the file is to be sent.  I then need to
> send the file to one or more "recipients" which may include a network share,
> email, webdav, and a web service.  It may go to one, multiple, or all of
> these destinations.  In some cases, where it ends up will also be dynamic,
> such as the path on a network share (e.g. I know the base share at
> configuration time, but ultimate path the file is copied to will be
> dynamic).
>
> Is this something that I can do with relative ease in Camel?  If so, can you
> help get me started?
>

Yes it is in fact.

You want to take a look at the dynamic recipient list EIP
http://camel.apache.org/recipient-list.html

And then you can use a POJO to compute the list of endpoints to send to.
The return type of your POJO can for example be String[], or List, or
Iterator etc. But to start simple you can use either a List<String> or
String[].

public List<String> computeSomeEndpoints(File file,
@Header("CamelFileName") String name) {
     ... compute some endpoints
    list.add("jms:queue:foo");
    list.add("ftp://someu...@someserver?password=secret";);
    return list;
}


And then use a route that route to the recipient list and use the bean
as expression

from("file://xxxx").recipientList().method(MyComputeBean.class);



> I realize that ESB-like products such as Camel may not be a perfect fit for
> this scenario, but Camel has so many of the features I need already built
> in...seems like it might be better than writing from scratch.
> --
> View this message in context: 
> http://old.nabble.com/Using-Camel-to-%22route%22-binary-files-tp26629157p26629157.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

Reply via email to