You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gramanero <gr...@gmail.com> on 2015/10/21 17:38:43 UTC

Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

I have searched through the user forum and done some research through Camel
docs as well, so if I missed the answer somewhere then I apologize.

I read that the File component is single threaded and what I would like to
be able to do, all while staying within Spring DSL, is to read file and fire
off a call to a web service. I do have this working, however I really want
to process the files in a multi-threaded fashion so as to speed up the
process. I can scale out using more servers, but that is less than ideal.

is there a way to queue up the name and location of the file, pull that info
off of a queue (i.e. from(activemq) and then read the file contents to fire
off to a web service, without getting back into a single threaded scenario?

Just looking for general direction and I should be able to take it from
there.

Much appreciated!



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

Posted by gramanero <gr...@gmail.com>.
I just discovered this article
(http://www.davsclaus.com/2009/05/on-road-to-camel-20-concurrency-with.html).
I think this answers my questions above. It is the <threads> that takes over
the file exchange as handles the file completion piece. That tells me that
the deletion of the file will happen in the <threads> message exchange and
that the File component is free to pick p another file.

If I am understanding that correctly, then that is exactly what i needed.



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942p5772946.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

Posted by gramanero <gr...@gmail.com>.
I think threads may be the way to go because i am using the File component in
a way that deletes the file upon successful processing. The WireTap route,
should it fail, means that my file is gone and I lose knowledge that the
File ever existed (I am still learning so perhaps that in and of itself is a
poor approach).

Also, I am stuck on Camel 2.8 so not sure how much flexibility I have with
threads, but essentially it looks like I would do something like this:

<route>
   <from uri="file://..."/>
   <threads poolSize=10">
      <call web service in here>
   </threads>
</route>

My question is, does this free up the single threaded file component to pick
up another file? If so, what happens if the processing inside the thread
fails? I suspect that the File component will have already deleted the file
at that point?

Thank you Claus for the quick response!




--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942p5772945.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

Posted by Claus Ibsen <cl...@gmail.com>.
Look at wire tap eip, or the threads eip.

On Wed, Oct 21, 2015 at 5:38 PM, gramanero <gr...@gmail.com> wrote:
> I have searched through the user forum and done some research through Camel
> docs as well, so if I missed the answer somewhere then I apologize.
>
> I read that the File component is single threaded and what I would like to
> be able to do, all while staying within Spring DSL, is to read file and fire
> off a call to a web service. I do have this working, however I really want
> to process the files in a multi-threaded fashion so as to speed up the
> process. I can scale out using more servers, but that is less than ideal.
>
> is there a way to queue up the name and location of the file, pull that info
> off of a queue (i.e. from(activemq) and then read the file contents to fire
> off to a web service, without getting back into a single threaded scenario?
>
> Just looking for general direction and I should be able to take it from
> there.
>
> Much appreciated!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition