You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lassesvestergaard <la...@gmail.com> on 2013/10/16 20:29:57 UTC

Add new route runtime

Hi all.

I simply can't get my head around this issue.

Let's say I have a running native java application that has a running
camelcontext. I deploy this application on a production server somewhere. In
the meantime I want to develop and test new routes in my own local
development environment. When I have tested the route, I now want to add the
route to the camelcontext running on the production server (I do it all with
java DSL). How would you do that?

You could just compile the single class that extends Routebuilder, upload it
to the production application and classload the file. But this would only
work in very simple and specific cases. What if I want to use external jars
in my route (I guess all this also relates to how I can register a newly
created bean in the camelcontext)? As I see it, I need to package the whole
route (including dependencies) as a jar, then upload it and classload the
whole jar. Is this really how it is done? Or do I use a completely wrong
approach? I'm extremely interested in knowing what/how you guys are doing in
this area. To me this scenario should be one of the most normal ones in
relation to camel, so I'm surprised that I can't find any examples on how to
do this.

As mentioned earlier, This entire question also relates to how I can insert
a new bean component at runtime.

Best regards

Lasse Vestergaard



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by lassesvestergaard <la...@gmail.com>.
Great. Thanks for your comments. I am actually creating the application as a
webapplication (jsf), and I'm using Tomcat for that. This means that I know
about auto deploying war file. As I see it, the problem is that I can't just
deploy a new war when ever I want to insert a new route (written in POJ). If
I do this, then I would stop all the running routes and maybe restart them
when the new deployment runs. This is an issue because I have to guarantee
that a route newer stops, unless I actively stop it (because it's deprecated
or something similar).

As I understand from your comments, I should look into OSGi.

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741725.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by Claus Ibsen <cl...@gmail.com>.
And if you want to load a route from an XML file using Camel API you
can take a look at this example.
http://camel.apache.org/loading-routes-from-xml-files.html

Though that is for adding new routes. To add new Java code at runtime,
then you really should take a look at using a container/server that
supports this (as its its primary purpose, to host other
applications).


On Wed, Oct 16, 2013 at 8:29 PM, lassesvestergaard
<la...@gmail.com> wrote:
> Hi all.
>
> I simply can't get my head around this issue.
>
> Let's say I have a running native java application that has a running
> camelcontext. I deploy this application on a production server somewhere. In
> the meantime I want to develop and test new routes in my own local
> development environment. When I have tested the route, I now want to add the
> route to the camelcontext running on the production server (I do it all with
> java DSL). How would you do that?
>
> You could just compile the single class that extends Routebuilder, upload it
> to the production application and classload the file. But this would only
> work in very simple and specific cases. What if I want to use external jars
> in my route (I guess all this also relates to how I can register a newly
> created bean in the camelcontext)? As I see it, I need to package the whole
> route (including dependencies) as a jar, then upload it and classload the
> whole jar. Is this really how it is done? Or do I use a completely wrong
> approach? I'm extremely interested in knowing what/how you guys are doing in
> this area. To me this scenario should be one of the most normal ones in
> relation to camel, so I'm surprised that I can't find any examples on how to
> do this.
>
> As mentioned earlier, This entire question also relates to how I can insert
> a new bean component at runtime.
>
> Best regards
>
> Lasse Vestergaard
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694.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

Re: Add new route runtime

Posted by contactreji <co...@gmail.com>.
Hi
If its a simple route,  you can even go for a blueprint deployment model. Just create the Camel routes and drop the XML file into the deploy folder of the jboss fuse.

If its got external dependency,  I would recommend you to add routes to the old package . As long as the artifact id, group Id and the version is same,  karaf will rewrite the existing package on the server with the updated ones.

Cheers
Reji 

"lassesvestergaard [via Camel]" <ml...@n5.nabble.com> wrote:

>
>
>Hi all.
>
>I simply can't get my head around this issue.
>
>Let's say I have a running native java application that has a running
>camelcontext. I deploy this application on a production server somewhere. In
>the meantime I want to develop and test new routes in my own local
>development environment. When I have tested the route, I now want to add the
>route to the camelcontext running on the production server (I do it all with
>java DSL). How would you do that?
>
>You could just compile the single class that extends Routebuilder, upload it
>to the production application and classload the file. But this would only
>work in very simple and specific cases. What if I want to use external jars
>in my route (I guess all this also relates to how I can register a newly
>created bean in the camelcontext)? As I see it, I need to package the whole
>route (including dependencies) as a jar, then upload it and classload the
>whole jar. Is this really how it is done? Or do I use a completely wrong
>approach? I'm extremely interested in knowing what/how you guys are doing in
>this area. To me this scenario should be one of the most normal ones in
>relation to camel, so I'm surprised that I can't find any examples on how to
>do this.
>
>As mentioned earlier, This entire question also relates to how I can insert
>a new bean component at runtime.
>
>Best regards
>
>Lasse Vestergaard
>
>
>
>_______________________________________________
>If you reply to this email, your message will be added to the discussion below:
>http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694.html
>
>To unsubscribe from Camel - Users, visit http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=Y29udGFjdHJlamlAZ21haWwuY29tfDQ2NTQyOHwxMDA0OTE4MjMz



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741716.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by saltnlight5 <sa...@gmail.com>.
Hi,

Sounds like you might want to try running Camel on an OSGI container. OSGI
let you managing jar and dependency without reloading, and each container
has it's own way of managing it. You would be happy to know that all Camel
artifacts are OSGI ready. You may read more information here:
http://camel.apache.org/how-to-run-camel-in-a-osgi-container.html

--
Zemian 



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741713.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by contactreji <co...@gmail.com>.
hi Christian

I have done that..

Cheers
Reji



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741844.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by Christian Müller <ch...@gmail.com>.
Please don't "hijack" posts/threads which questions which don't belong to
the subject.

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Sat, Oct 19, 2013 at 6:17 AM, contactreji <co...@gmail.com> wrote:

> Hi Claus
>
> I have an issue here.
> When I reply to any post via email, it goes to the emailing list without
> moderators intervention. But the replies on that post never comes to my
> email.
> Can I set "Alert me by email when someone posts to this thread" option when
> I send posts via my Emails?
>
> On the other hand if i post the same from Nabble webpage, I have option to
> tick the checkbox "Alert me by email when someone posts to this thread" and
> hence I get all posts related to current post. But it goes via the
> moderator!
>
> Could you help me with this?
>
> Reji
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741882.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Add new route runtime

Posted by contactreji <co...@gmail.com>.
Hi Claus 

I have an issue here. 
When I reply to any post via email, it goes to the emailing list without
moderators intervention. But the replies on that post never comes to my
email. 
Can I set "Alert me by email when someone posts to this thread" option when
I send posts via my Emails? 

On the other hand if i post the same from Nabble webpage, I have option to
tick the checkbox "Alert me by email when someone posts to this thread" and
hence I get all posts related to current post. But it goes via the
moderator! 

Could you help me with this? 

Reji



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741882.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by Christian Mueller <ch...@gmail.com>.
Reji,

can you please subscribe to the discussion forum in Nabble as we describe
here [1].
Otherwise all your mails has to be moderate manually by the Camel team so
that your post is also send to our mailing list which most of the Camel team
member are using instead of Nabble. Therefore your post is may
missed/delayed and you don't get an answer in the normal time frame we
answer questions.
Last but not least, it cost time which we cannot spend developing Camel,
answering questions or improving the documentation...

[1] http://camel.apache.org/discussion-forums.html

Thanks in advance,
Christian



--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741758.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

Posted by contactreji <co...@gmail.com>.
Hi

If the route is very simple and can run with the dependencies already
available in the Karaf, you can go for Blueprint deployment model by simply
dropping the camel xml file containing the routes into the Fuse
Installation/deploy folder.
If it contains external jars/POM dependencies downloaded as jars, i would
recommend adding routes into the old project and then rebuild the project
using Maven.
When you deploy, if there is not change in the project artifact id, group
id and version,, the fuse will replace the old deployed bundle with the
updated one.

Cheers
Reji


On Wed, Oct 16, 2013 at 11:29 AM, lassesvestergaard [via Camel] <
ml-node+s465427n5741694h93@n5.nabble.com> wrote:

> Hi all.
>
> I simply can't get my head around this issue.
>
> Let's say I have a running native java application that has a running
> camelcontext. I deploy this application on a production server somewhere.
> In the meantime I want to develop and test new routes in my own local
> development environment. When I have tested the route, I now want to add
> the route to the camelcontext running on the production server (I do it all
> with java DSL). How would you do that?
>
> You could just compile the single class that extends Routebuilder, upload
> it to the production application and classload the file. But this would
> only work in very simple and specific cases. What if I want to use external
> jars in my route (I guess all this also relates to how I can register a
> newly created bean in the camelcontext)? As I see it, I need to package the
> whole route (including dependencies) as a jar, then upload it and classload
> the whole jar. Is this really how it is done? Or do I use a completely
> wrong approach? I'm extremely interested in knowing what/how you guys are
> doing in this area. To me this scenario should be one of the most normal
> ones in relation to camel, so I'm surprised that I can't find any examples
> on how to do this.
>
> As mentioned earlier, This entire question also relates to how I can
> insert a new bean component at runtime.
>
> Best regards
>
> Lasse Vestergaard
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694.html
>  To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=Y29udGFjdHJlamlAZ21haWwuY29tfDQ2NTQyOHwxMDA0OTE4MjMz>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694p5741714.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Add new route runtime

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

Yeah as the other people in this thread have said. Sounds like you
need to use a container/server that supports deploying applications on
the fly, and then you can integrate your applications using Camel
components, or technologies that would support that (for example OSGi
services / EJB etc). With OSGi you can declare an OSGi service which
other applications (bundles) can use. This allows you to call OSGi
services (a pojo exposed with an interface) from any bundle, also from
Camel routes.

For example Karaf, ServiceMix, Tomcat, JBoss AS, Jetty, et all are
containers that could support this.



On Wed, Oct 16, 2013 at 8:29 PM, lassesvestergaard
<la...@gmail.com> wrote:
> Hi all.
>
> I simply can't get my head around this issue.
>
> Let's say I have a running native java application that has a running
> camelcontext. I deploy this application on a production server somewhere. In
> the meantime I want to develop and test new routes in my own local
> development environment. When I have tested the route, I now want to add the
> route to the camelcontext running on the production server (I do it all with
> java DSL). How would you do that?
>
> You could just compile the single class that extends Routebuilder, upload it
> to the production application and classload the file. But this would only
> work in very simple and specific cases. What if I want to use external jars
> in my route (I guess all this also relates to how I can register a newly
> created bean in the camelcontext)? As I see it, I need to package the whole
> route (including dependencies) as a jar, then upload it and classload the
> whole jar. Is this really how it is done? Or do I use a completely wrong
> approach? I'm extremely interested in knowing what/how you guys are doing in
> this area. To me this scenario should be one of the most normal ones in
> relation to camel, so I'm surprised that I can't find any examples on how to
> do this.
>
> As mentioned earlier, This entire question also relates to how I can insert
> a new bean component at runtime.
>
> Best regards
>
> Lasse Vestergaard
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Add-new-route-runtime-tp5741694.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