You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Samruben <ra...@gmail.com> on 2012/02/14 08:00:54 UTC

loading xml file

Hi 
I am a new user to camel.

Could you provide me some example in which, the service should load the xml
from file system(the xml contains the flow for the service) and should
execute it when a service is called.

Thank you.



--
View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481677.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: loading xml file

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 14, 2012 at 10:01 AM, Samruben <ra...@gmail.com> wrote:
> Hi
> I have seen some simplerouterfromxml java file in the link
>
> http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/SpringLoadRouteFromXmlTest.java?view=markup&pathrev=1040085
>
> whether I need to do the same thing or its for older version?
>
> // load route from XML and add them to the existing camel context
> InputStream is = getClass().getResourceAsStream("barRoute.xml");
> RoutesDefinition routes = context.loadRoutesDefinition(is);
> context.addRouteDefinitions(routes.getRoutes());
>
> what jars do i need to include the Inputstream?
>

What do you mean? The code above just needs camel-core JAR.

> --
> View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481895.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: loading xml file

Posted by Samruben <ra...@gmail.com>.
Hi 
I have seen some simplerouterfromxml java file in the link

http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jaxb/SpringLoadRouteFromXmlTest.java?view=markup&pathrev=1040085

whether I need to do the same thing or its for older version?

// load route from XML and add them to the existing camel context
InputStream is = getClass().getResourceAsStream("barRoute.xml");
RoutesDefinition routes = context.loadRoutesDefinition(is);
context.addRouteDefinitions(routes.getRoutes());

what jars do i need to include the Inputstream?

--
View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481895.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: loading xml file

Posted by Vincent Nonnenmacher <vi...@gmail.com>.
Samruben

I highly recommend the "camel on action" book it is enlightning to say the
least.


On Tuesday, February 14, 2012, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Feb 14, 2012 at 8:36 AM, Samruben <ra...@gmail.com> wrote:
>> Thank you for your reply.
>>
>> I have gone through it. Is there any demo example implemented this
concept
>> in already existing camel examples?
>>
>
> No there is no examples.
>
>> --
>> View this message in context:
http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481741.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> 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/
>

Re: loading xml file

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 14, 2012 at 8:36 AM, Samruben <ra...@gmail.com> wrote:
> Thank you for your reply.
>
> I have gone through it. Is there any demo example implemented this concept
> in already existing camel examples?
>

No there is no examples.

> --
> View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481741.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: loading xml file

Posted by Samruben <ra...@gmail.com>.
Thank you for your reply.

I have gone through it. Is there any demo example implemented this concept
in already existing camel examples? 

--
View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481741.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: loading xml file

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

You can take a look at this little example, its about loading a Camel
XML route and adding it as a route to Camel:
http://camel.apache.org/loading-routes-from-xml-files.html


On Tue, Feb 14, 2012 at 8:00 AM, Samruben <ra...@gmail.com> wrote:
> Hi
> I am a new user to camel.
>
> Could you provide me some example in which, the service should load the xml
> from file system(the xml contains the flow for the service) and should
> execute it when a service is called.
>
> Thank you.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/loading-xml-file-tp5481677p5481677.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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