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: Camel noob question about how to make a precisely number of GET request on a url
Date Thu, 20 Nov 2014 16:06:01 GMT
Hi

If you need to get the ids from a file first, then start with that


from file
  split body tokenize \n (assume each id is on a new line or something)
       to http (*)
     ?? what to do with the response from the get ?
   end

what do you need to do with the response from each get? Do you need to
discard it, or write to a new file, or do you need to combine all 10
responses into a single response?

Also see the link for (*)

I suggest to study a few of the components and eips you need to use

http://camel.apache.org/file2
http://camel.apache.org/http
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html (*)
http://camel.apache.org/splitter.html



On Thu, Nov 20, 2014 at 4:25 PM, daninovac <danynovac@gmail.com> wrote:
> Hello,
> I've been dealing with this problem for some hours and after searches and
> searches I decided to post it here. I'm new to Apache Camel, so don't judge
> me, but I need a response or an idea to my issue.
>
> Ok, so I need to get a json from a GET request on a specified url. Luckily,
> that GET method returns a JSON so no many headaches.
> I've made this like:
> <camel:route>
> <camel:from uri="GET_reqURL" />
> <camel:to uri="file:src/main/resources/TEST" />
> </camel:route>
>
> I put all the json files in a TEST folder, as you can see. The problem is
> the GET request are made continuously and my TEST folder keep updating. The
> files from the folder had the same content but the last two numbers, or
> three from the file names, keep changing, wich is ok, I think.
>
> Now the problem is: I need to get some id's from a txt file (let's say) and
> for each id I need to call a GET method. If I have 10 id's in a txt file, I
> need to see just 10 files in my TEST folder and I really don't know how to
> put this in my camel code.
> Oh, I use Spring DSL, btw.
>
> Thanks in advance and sorry If it is a stupid question.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-noob-question-about-how-to-make-a-precisely-number-of-GET-request-on-a-url-tp5759365.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message