You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by daninovac <da...@gmail.com> on 2014/11/26 16:44:53 UTC

How to stop a route from processing get requests continously

I have the next scenario:

I need to implement something like this:
I have a file.txt with id's
I have splitted those id's by \n and I need to do:
>From file.txt ->
         split-> 
         for each id make a GET request on a url (www.example.com). This url
send to me some JSON ->
         Unmarshal JSON to xml.
That's all.
My ideas & implementation:
       1. route from url to some output (let's say I will put the JSON's in
a folder).
             <route autostartup="false">
             <from uri="example.com" />
             <to: uri="JSONFolder"/>
             </route>
      2. route from file.txt to seda
             <route >
             <from uri="file.txt" />
              <make a split>
             <to: uri="seda:ids"/>
             </route>
      3. route from seda:ids to myProcessor
             <route >
             <from uri="seda:ids" />
              <processor>
             </route>
          myProcessor just starts the route from where I GET the JSONs

*The problem is*: I need a JSON for each id. One id will have a JSON file.
But the GET is making requests continuously to the url. And I end with a lot
of JSONs instead of the same nr of JSONs as the number of id's.
*How can I stop the 1st route from making requests continously??*
I tought seda will solve it and the nr of requests will be the same number
as the id's from my file, but I'm wrong somehow.

Thanks, guys!



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-a-route-from-processing-get-requests-continously-tp5759649.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop a route from processing get requests continously

Posted by daninovac <da...@gmail.com>.
I did this and it only brings me just one JSON from url, not how many
elements I have in seda. How can I fix this?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-a-route-from-processing-get-requests-continously-tp5759649p5759690.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop a route from processing get requests continously

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

On Fri, Nov 28, 2014 at 10:35 AM, daninovac <da...@gmail.com> wrote:
> I'm coming with another question.
> How can I append the id values from my .txt file into an url.
> I need to make GET req to this url: http://example.com/345
> How can I add insted of 345 ids from my .txt file
> like: http://example.com/firstId
> http://example.com/secondId
> etc?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-a-route-from-processing-get-requests-continously-tp5759649p5759753.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/

Re: How to stop a route from processing get requests continously

Posted by daninovac <da...@gmail.com>.
I'm coming with another question.
How can I append the id values from my .txt file into an url. 
I need to make GET req to this url: http://example.com/345
How can I add insted of 345 ids from my .txt file
like: http://example.com/firstId
http://example.com/secondId
etc?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-a-route-from-processing-get-requests-continously-tp5759649p5759753.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop a route from processing get requests continously

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See the timer or quartz component for a scheduler and make it run 1 time etc


On Wed, Nov 26, 2014 at 4:44 PM, daninovac <da...@gmail.com> wrote:
> I have the next scenario:
>
> I need to implement something like this:
> I have a file.txt with id's
> I have splitted those id's by \n and I need to do:
> From file.txt ->
>          split->
>          for each id make a GET request on a url (www.example.com). This url
> send to me some JSON ->
>          Unmarshal JSON to xml.
> That's all.
> My ideas & implementation:
>        1. route from url to some output (let's say I will put the JSON's in
> a folder).
>              <route autostartup="false">
>              <from uri="example.com" />
>              <to: uri="JSONFolder"/>
>              </route>
>       2. route from file.txt to seda
>              <route >
>              <from uri="file.txt" />
>               <make a split>
>              <to: uri="seda:ids"/>
>              </route>
>       3. route from seda:ids to myProcessor
>              <route >
>              <from uri="seda:ids" />
>               <processor>
>              </route>
>           myProcessor just starts the route from where I GET the JSONs
>
> *The problem is*: I need a JSON for each id. One id will have a JSON file.
> But the GET is making requests continuously to the url. And I end with a lot
> of JSONs instead of the same nr of JSONs as the number of id's.
> *How can I stop the 1st route from making requests continously??*
> I tought seda will solve it and the nr of requests will be the same number
> as the id's from my file, but I'm wrong somehow.
>
> Thanks, guys!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-a-route-from-processing-get-requests-continously-tp5759649.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/