You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rodrigo Valerio <rs...@gmail.com> on 2009/03/03 04:15:59 UTC

Camel with my app

I try to integrate camel into my app, but without success. 

Using spring integration, if i run by Main class (like examples), all run`s
ok.

How i get a CamelContext or Template instance in my app class?

I see al the documentation, but can`t solve this simple (i think) problem: 
How is the best way to do this. 

My webapp class, isn`t instantiated by spring and i don`t any expertise with
spring too.

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Camel-with-my-app-tp22301780p22301780.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel with my app

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

If you have the time then you can check out this lengthy tutorial that
starts from 0 and over time shows how to do it smarter.
http://camel.apache.org/tutorial-example-reportincident.html

And this one for a webapp with axis camel and spring
http://camel.apache.org/tutorial-axis-camel.html

And this first example that is java based:
http://camel.apache.org/walk-through-an-example.html

But its a good idea to check the tutorials and examples.


On Tue, Mar 3, 2009 at 6:26 AM, Hadrian Zbarcea <hz...@gmail.com> wrote:
> Hi Rodrigo,
>
> There is not magic (ok, maybe just a tiny bit).  Try something like this:
>
>        CamelContext camel = new DefaultCamelContext();
>
>        // lets add some routes
>        container.addRoutes(new RouteBuilder() {
>            public void configure() {
>                from("direct:start").process(new Processor() {
>                    public void process(Exchange e) {
>                        // whatever you want in here
>                    }
>                });
>            }
>        });
>
>        camel.start();
>
>
> You don't necessarily need spring, but it's a handy way to wire route
> components.  There are plenty of protocols and integration patterns we
> support, please change the "direct:start" endpoint and the content of the
> route at will.
>
> Cheers
> Hadrian
>
>
>
> On Mar 2, 2009, at 10:15 PM, Rodrigo Valerio wrote:
>
>>
>> I try to integrate camel into my app, but without success.
>>
>> Using spring integration, if i run by Main class (like examples), all
>> run`s
>> ok.
>>
>> How i get a CamelContext or Template instance in my app class?
>>
>> I see al the documentation, but can`t solve this simple (i think) problem:
>> How is the best way to do this.
>>
>> My webapp class, isn`t instantiated by spring and i don`t any expertise
>> with
>> spring too.
>>
>> Thanks in advance.
>> --
>> View this message in context:
>> http://www.nabble.com/Camel-with-my-app-tp22301780p22301780.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel with my app

Posted by Hadrian Zbarcea <hz...@gmail.com>.
Hi Rodrigo,

There is not magic (ok, maybe just a tiny bit).  Try something like  
this:

         CamelContext camel = new DefaultCamelContext();

         // lets add some routes
         container.addRoutes(new RouteBuilder() {
             public void configure() {
                 from("direct:start").process(new Processor() {
                     public void process(Exchange e) {
                         // whatever you want in here
                     }
                 });
             }
         });

         camel.start();


You don't necessarily need spring, but it's a handy way to wire route  
components.  There are plenty of protocols and integration patterns we  
support, please change the "direct:start" endpoint and the content of  
the route at will.

Cheers
Hadrian



On Mar 2, 2009, at 10:15 PM, Rodrigo Valerio wrote:

>
> I try to integrate camel into my app, but without success.
>
> Using spring integration, if i run by Main class (like examples),  
> all run`s
> ok.
>
> How i get a CamelContext or Template instance in my app class?
>
> I see al the documentation, but can`t solve this simple (i think)  
> problem:
> How is the best way to do this.
>
> My webapp class, isn`t instantiated by spring and i don`t any  
> expertise with
> spring too.
>
> Thanks in advance.
> -- 
> View this message in context: http://www.nabble.com/Camel-with-my-app-tp22301780p22301780.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>