You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michael Szalay <mi...@basis06.ch> on 2012/02/29 18:07:20 UTC

Newbie questions on camel

Hi all

I'm new to camel. I try to model the following data flow process

1) Create some objects that all other processors in the route can share
2) Load some values from the database
3) For each value in the database
   3a) make a http request
   3b) save the file from the 3a) in a directory structure

I'm not sure about point 1. Is it possible to define such objects and where do I put them? In the camel context?
How can I access them?

About points 3): how can I make 3a) and 3b) dynamic so that these steps execute for each value provided by
the step 2)?

Thanks for any startup hints.

Regards Michael

-- 
Michael Szalay
Senior Software Engineer

basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22
http://www.basis06.ch - source of smart business 


Re: Newbie questions on camel

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

On your first point.

 1) Create some objects that all other processors in the route can share

This is indeed possible. The CamelContext contains a registry where you can
store such objects as singletons or regular objects and refer to them in
Camel routes and processors. This is automatic if you use Spring since the
CamelContext is aware of beans created in Spring and stores them in the
registry automatically. You can also use your own registry implementation
(JNDI or custom) to store and refer to such objects as follows.

http://camel.apache.org/ref.html http://camel.apache.org/ref.html 

As for 2,3 and 4 you could do it as follows
             from("quartz:XXX or timer:YYY")
                 .to ("sql:ZZZ or hibernate:AAA or bean:XYZ")
                 .to ("jetty:http://WWW")
                 .to("file:///dir/FOOBAR/");

To make things dynamic as far as injecting endpoints are concerned, you
could use the registry or properties component.

http://camel.apache.org/properties.html
http://camel.apache.org/properties.html 

Hope this helps.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Newbie-questions-on-camel-tp5525500p5526310.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Newbie questions on camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 29, 2012 at 6:07 PM, Michael Szalay
<mi...@basis06.ch> wrote:
> Hi all
>
> I'm new to camel. I try to model the following data flow process
>
> 1) Create some objects that all other processors in the route can share
> 2) Load some values from the database
> 3) For each value in the database
>   3a) make a http request
>   3b) save the file from the 3a) in a directory structure
>
> I'm not sure about point 1. Is it possible to define such objects and where do I put them? In the camel context?
> How can I access them?
>
> About points 3): how can I make 3a) and 3b) dynamic so that these steps execute for each value provided by
> the step 2)?
>

At step 3 sounds like the Splitter EIP
http://camel.apache.org/splitter

> Thanks for any startup hints.
>
> Regards Michael
>
> --
> Michael Szalay
> Senior Software Engineer
>
> basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22
> http://www.basis06.ch - source of smart business
>



-- 
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/