Claus, Yes, beer is on me. The explanation makes sense but I'll ping you on usage of the model.
I made the change after hunting an NPE when upgrading code from an older Camel release. On Dec 17, 2010, at 11:15 AM, Claus Ibsen wrote: > That you commit something which you shouldn't have done. > > Today it was Johan's Ed. first time he did that. Welcome to the club. > I am the president, I must have committed the most bad commits to > Camel :) > > Your little change in the route model (FromDefinition) really got me > puzzled today. > http://svn.apache.org/viewvc?rev=1050112&view=rev > > I have been working on a bigger improvement and have changed files in > core, core-xml, spring. And suddenly I got unit test failures in > camel-spring. > I wondered why because the commits today have been simple and not in > that area. And the CI servers have been busy with other projects and > haven't got around testing the latest commits from trunk. So I > couldn't see the test failures there. > > Anyway I digged into it, and almost had me wished I have switched to > git, so I can do a stach. Yeah I will switch later. Writing a book > took all my time. > Then I remembered your commit. The problem is that the route model > must be stateless and agnostic, eg not tied to a runtime CamelContext. > You can use the route model to create runtime routes, and thus it can > act as a skeleton. > > So in your change you introduced state as it remembered the endpoint > you would lookup at runtime. But the problem is that you could have it > lookup endpoints from CamelContext A and then use the route model to > create a new runtime route in another camel context or whatever. Then > that endpoint is no looked up in CamelContext B, but it will just use > the existing it previous looked up from CamelContext A. > > For example using the routeContext in XML. > http://camel.apache.org/configuring-camel.html > > You may consider buying a beer when we meet. My wife got a bit cranky > because I was occupied digging into this issue, > than talking with her when she came home from work. > > Anyway welcome to the club. > > I actually wrote this as a reminder to us all about the route model > must be stateless. The mistake here could be done by any of us, so > there are no hard feelings. Just that it took me for a little ride, > which doesn't happend that often anymore with Camel. (Well except > crappy and mysterious issues with osgi, but that's another story for > all of us). > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/