camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Sending route for execution
Date Sun, 04 Jan 2015 08:36:23 GMT
On Sat, Jan 3, 2015 at 11:44 AM, Tim Dudgeon <tdudgeon.ml@gmail.com> wrote:
> I am trying to work out best approaches to sending a route to a remote
> CamelContext for execution. e.g. I have a client that generates the route
> definition and then needs to send it to a sever for execution.
>
> I notice that you can apply a new route to an existing context:
> http://camel.apache.org/loading-routes-from-xml-files.html
> Q. Is spring XML the only format supported?

No /spring is just the namespace for historical reasons. You can use
this with any kind of Camel (standalone, spring, war, blueprint, etc.)




> Q. Is there a way to generate the route using the Java object model and then
> generate the XML from that?

Yes all Camel routes become the model classes when Camel startup,
regardless how the end user define the routes: whether he/she uses
xml, java code, groovy code, scala code etc. It all becomes a graph of
those model classes.

And you can output those model classes in XML as they are JAXB
annotated. There is API to do that more easily. See this helper:
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java




>
> I also see the ManagedCamelContextMBean.addOrUpdateRoutesFromXml() method:
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.html#addOrUpdateRoutesFromXml(java.lang.String)
> Q. Presumably this is the approach to use for remote deployment?
>

Yeah you can also update / add routes from xml over JMX as that api
supports. But yeah it does this at runtime and do not "save" the
updates. So if the JVM crashes the changes are "gone".


> I also seem to recall some mechanism for deploying camel "jobs" to a server,
> but can't find this right now. Is there such a thing.
>
> And in terms of scalability, I'm assuming that the CamelContext is quite a
> heavyweight object, so its better (in general terms) to deploy multiple
> routes to one context rather than end up with having a large number of
> contexts running each with one or two routes?
>

Kinda depends. How to slice and dice. Its more a deployment question
how independent you want these routes to be.

> Sorry for all the questions :-(
>
> Tim



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

Mime
View raw message