You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bob Jolliffe <bo...@gmail.com> on 2012/07/28 11:53:40 UTC

RouteDefinition vs Route

A quick question which I am sure has an easy answer but I am getting a
bit befuddled ...

A have a simple web user interface where I want to list routes in a
context with their id's and descrtiption.  One purpose is being able
to stop and start them.  Because I am interested in the description I
am calling getRouteDefinitions() off the camel context to get my list
(my first instinct was to call getRoutes() ).  But what is the
difference between the RouteDefinition and the Route?  Or maybe more
to the point, what is the relationship between them?  If I have a
RouteDefinition there isn't a getRoute() method on it.

Does this imply that that will not be necessarily a one to one
relationship between them.  I could have a RouteDefinition and use it
to create many Routes?  Sorry if I seem confused - if there is a
relevant section of the docs to look at please point me there if you
can.

Regards
Bob

Re: RouteDefinition vs Route

Posted by Bob Jolliffe <bo...@gmail.com>.
Thanks Sam.  I've solved my immediate problem so I don't need
integrate camelwatch at this stage ... though I do like it and if I
get the chance I will try and send a patch anyway.

Regards
Bob

On 29 July 2012 17:29, Sam (Stephen Samuel) <sa...@gmail.com> wrote:
> I can update camelwatch to add in extra properties, or you could
> update the project and do a pull request.
>
> On Sat, Jul 28, 2012 at 7:45 PM, Bob Jolliffe <bo...@gmail.com> wrote:
>> Ah .. just realized that if I cast my CamelContext to a
>> ModelCamelContext I can do all I need to do with RouteDefinitions
>> (rather than Routes)
>>
>> On 28 July 2012 17:54, Bob Jolliffe <bo...@gmail.com> wrote:
>>> Thanks Babak
>>>
>>> On 28 July 2012 11:42, Babak Vahdat <ba...@swissonline.ch> wrote:
>>>> Hi
>>>>
>>>> the easiest is to check their javadoc:
>>>>
>>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Route.html
>>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/RouteDefinition.html
>>>
>>> Have done that ...
>>>
>>>> Another way around, in the context of the MVC pattern one could claim that
>>>> the RouteDefinition is 'M' (using JAXB for mapping between Java/XML) whereas
>>>> the Route abstraction is both the 'V' as well as 'C'.
>>>
>>> I almost get what you are saying but it doesn't quite work for me.  If
>>> the Route is a view (which I know is a bit of a stretch) then it has
>>> to be a view of something.  I guess I would expect to see a
>>> getRouteDefinition() method on the Route in that case.
>>>
>>> So my question is that starting from the Context you can get a list of
>>> Routes and a list of RouteDefinitions.  How do these relate to one
>>> another?  I can see that if the Route/RouteDefinitions have an id.
>>> then you can find one from the other through that, but the coupling is
>>> loose and possibly for a good reason.
>>>
>>> It seems more that a RouteDefinition is a sort of template for
>>> creating a Route .. probably there is something historic in this as
>>> the javadocs refer specifically to the <route /> element, so there is
>>> clearly a jaxb model type relationship.  Except that the configure()
>>> method of RouteBuilder also creates a RouteDefinition rather than a
>>> Route, so RouteDefinition is a bit broader in its semantics than
>>> that..
>>>
>>> Still exploring further .. thanks.
>>> Bob
>>>
>>>>
>>>> Babak
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716579.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> -Sam

Re: RouteDefinition vs Route

Posted by "Sam (Stephen Samuel)" <sa...@gmail.com>.
I can update camelwatch to add in extra properties, or you could
update the project and do a pull request.

On Sat, Jul 28, 2012 at 7:45 PM, Bob Jolliffe <bo...@gmail.com> wrote:
> Ah .. just realized that if I cast my CamelContext to a
> ModelCamelContext I can do all I need to do with RouteDefinitions
> (rather than Routes)
>
> On 28 July 2012 17:54, Bob Jolliffe <bo...@gmail.com> wrote:
>> Thanks Babak
>>
>> On 28 July 2012 11:42, Babak Vahdat <ba...@swissonline.ch> wrote:
>>> Hi
>>>
>>> the easiest is to check their javadoc:
>>>
>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Route.html
>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/RouteDefinition.html
>>
>> Have done that ...
>>
>>> Another way around, in the context of the MVC pattern one could claim that
>>> the RouteDefinition is 'M' (using JAXB for mapping between Java/XML) whereas
>>> the Route abstraction is both the 'V' as well as 'C'.
>>
>> I almost get what you are saying but it doesn't quite work for me.  If
>> the Route is a view (which I know is a bit of a stretch) then it has
>> to be a view of something.  I guess I would expect to see a
>> getRouteDefinition() method on the Route in that case.
>>
>> So my question is that starting from the Context you can get a list of
>> Routes and a list of RouteDefinitions.  How do these relate to one
>> another?  I can see that if the Route/RouteDefinitions have an id.
>> then you can find one from the other through that, but the coupling is
>> loose and possibly for a good reason.
>>
>> It seems more that a RouteDefinition is a sort of template for
>> creating a Route .. probably there is something historic in this as
>> the javadocs refer specifically to the <route /> element, so there is
>> clearly a jaxb model type relationship.  Except that the configure()
>> method of RouteBuilder also creates a RouteDefinition rather than a
>> Route, so RouteDefinition is a bit broader in its semantics than
>> that..
>>
>> Still exploring further .. thanks.
>> Bob
>>
>>>
>>> Babak
>>>
>>>
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716579.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
-Sam

Re: RouteDefinition vs Route

Posted by Bob Jolliffe <bo...@gmail.com>.
Ah .. just realized that if I cast my CamelContext to a
ModelCamelContext I can do all I need to do with RouteDefinitions
(rather than Routes)

On 28 July 2012 17:54, Bob Jolliffe <bo...@gmail.com> wrote:
> Thanks Babak
>
> On 28 July 2012 11:42, Babak Vahdat <ba...@swissonline.ch> wrote:
>> Hi
>>
>> the easiest is to check their javadoc:
>>
>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Route.html
>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/RouteDefinition.html
>
> Have done that ...
>
>> Another way around, in the context of the MVC pattern one could claim that
>> the RouteDefinition is 'M' (using JAXB for mapping between Java/XML) whereas
>> the Route abstraction is both the 'V' as well as 'C'.
>
> I almost get what you are saying but it doesn't quite work for me.  If
> the Route is a view (which I know is a bit of a stretch) then it has
> to be a view of something.  I guess I would expect to see a
> getRouteDefinition() method on the Route in that case.
>
> So my question is that starting from the Context you can get a list of
> Routes and a list of RouteDefinitions.  How do these relate to one
> another?  I can see that if the Route/RouteDefinitions have an id.
> then you can find one from the other through that, but the coupling is
> loose and possibly for a good reason.
>
> It seems more that a RouteDefinition is a sort of template for
> creating a Route .. probably there is something historic in this as
> the javadocs refer specifically to the <route /> element, so there is
> clearly a jaxb model type relationship.  Except that the configure()
> method of RouteBuilder also creates a RouteDefinition rather than a
> Route, so RouteDefinition is a bit broader in its semantics than
> that..
>
> Still exploring further .. thanks.
> Bob
>
>>
>> Babak
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716579.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RouteDefinition vs Route

Posted by Bob Jolliffe <bo...@gmail.com>.
Thanks Babak

On 28 July 2012 11:42, Babak Vahdat <ba...@swissonline.ch> wrote:
> Hi
>
> the easiest is to check their javadoc:
>
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Route.html
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/RouteDefinition.html

Have done that ...

> Another way around, in the context of the MVC pattern one could claim that
> the RouteDefinition is 'M' (using JAXB for mapping between Java/XML) whereas
> the Route abstraction is both the 'V' as well as 'C'.

I almost get what you are saying but it doesn't quite work for me.  If
the Route is a view (which I know is a bit of a stretch) then it has
to be a view of something.  I guess I would expect to see a
getRouteDefinition() method on the Route in that case.

So my question is that starting from the Context you can get a list of
Routes and a list of RouteDefinitions.  How do these relate to one
another?  I can see that if the Route/RouteDefinitions have an id.
then you can find one from the other through that, but the coupling is
loose and possibly for a good reason.

It seems more that a RouteDefinition is a sort of template for
creating a Route .. probably there is something historic in this as
the javadocs refer specifically to the <route /> element, so there is
clearly a jaxb model type relationship.  Except that the configure()
method of RouteBuilder also creates a RouteDefinition rather than a
Route, so RouteDefinition is a bit broader in its semantics than
that..

Still exploring further .. thanks.
Bob

>
> Babak
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716579.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RouteDefinition vs Route

Posted by Bob Jolliffe <bo...@gmail.com>.
On 28 July 2012 12:11, Babak Vahdat <ba...@swissonline.ch> wrote:
> And also CamelWatch could be of your interest which does already what you try
> to achieve:
>
> http://sksamuel.github.com/camelwatch/

This looks very nice.  As you say, very much like I want to do, except
that I was hoping to get the description properties from the
RouteDefinitions ... maybe its not possible or even correct to try and
do this.

Bob

>
> BTW reading the javadoc by myself it seems the 'C' (Controller) is
> ModelCamelContext which can start / stop routes (the View) using their Id's.
> That's the API methods like:
>
> startRoute(String routeId)
> stopRoute(String routeId)
>
> etc. etc.
>
> Babak
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716580.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RouteDefinition vs Route

Posted by Babak Vahdat <ba...@swissonline.ch>.
And also CamelWatch could be of your interest which does already what you try
to achieve:

http://sksamuel.github.com/camelwatch/

BTW reading the javadoc by myself it seems the 'C' (Controller) is
ModelCamelContext which can start / stop routes (the View) using their Id's.
That's the API methods like:

startRoute(String routeId)
stopRoute(String routeId)

etc. etc.

Babak



--
View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716580.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RouteDefinition vs Route

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

the easiest is to check their javadoc:

http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Route.html
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/RouteDefinition.html

Another way around, in the context of the MVC pattern one could claim that
the RouteDefinition is 'M' (using JAXB for mapping between Java/XML) whereas
the Route abstraction is both the 'V' as well as 'C'.

Babak



--
View this message in context: http://camel.465427.n5.nabble.com/RouteDefinition-vs-Route-tp5716578p5716579.html
Sent from the Camel - Users mailing list archive at Nabble.com.