On 17/01/2008, Roman Kalukiewicz <[EMAIL PROTECTED]> wrote: > 2008/1/17, Roman Kalukiewicz <[EMAIL PROTECTED]>: > > 2008/1/17, DominicTulley <[EMAIL PROTECTED]>: > > > > > > Hi, I've written a RouteBuilder implementation which I am deploying in > > > AMQ/Camel using the <package> element in the CamelContext. > > > This is working fine - the router deploys and runs as expected. However, > > > I > > > really want to have some configurable properties in this class and I'm > > > struggling to work out how to do this. > > > > > > I thought of creating another bean in the activemq.xml file (just a plain > > > old bean that contains configuration information and can be customised in > > > the xml file). Is there any way for my router to find the singleton > > > instance that gets created? Also, is there a way to make the dependency > > > explicit, so that initialisation of the route builder is deferred until > > > after the config bean has been built? > > > > > > I'm a bit stumped and would appreciate suggestions either on how to make > > > this way work, or an alternative approach. > > > > Maybe you simply could use: > > > > <camelContext> > > <routeBuilder><ref id="myBuilder"/></routeBuilder> > > </camelContext> > > > > <bean id="myBuilder" class="dominic.DominicsRouteBuilder"> > > <property name="foo" value="bar"/> > > </bean> > > > > This way you can configure your builder however you want in Spring. > > You can also use <additionalBuilders> element that requires a list of > > builders. > > > > I'm not sure if it is what you are asking for, but I hope it helps. > > > > BTW I've never done it personally - I'm just looking into the code ;) > > > > Roman > > > > Oups - I've just noticed @XmlTransient annotation there on > routeBuilder property so (as James outlined while I was writing my > message) it is not gonna work :(
:( A RouteBuilder is not necessarily gonna be XML marshallable via JAXB; so we might just wanna refer to RouteBuilder instances by ID in the XML. -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com
