that didn't work :( Camel is instantiating the Processor bean independently of the FileSystemXmlApplicationContext given to it in:
protected AbstractXmlApplicationContext createApplicationContext() camel creates a new instance of the Processor on each call to sendBody Alistair -- mov eax,1 mov ebx,0 int 80h On 7 Jul 2011, at 11:01, Claus Ibsen wrote: > Ah okay so you use the prototype scope of spring XML. > > Well the <process ref="xxx"/> lookup the processor once when the route > is initialized. > > You may want to use the Camel bean component and disable its cache > http://camel.apache.org/bean > > Try something like this > <to uri="bean:testProcessor?cache=false"/> > > > > On Thu, Jul 7, 2011 at 11:43 AM, Alistair Young > <alistair.yo...@uhi.ac.uk> wrote: >> sorry if I'm fuddling about too much. Perhaps if I rephrase: >> >> How would I change the config of a Processor at run time in a test? >> >> <route> >> <from uri="activemq:topic:test"/> >> <transacted /> >> <process ref="testProcessor" /> >> <to uri="activemq:topic:test2"/> >> </route> >> >> <bean id="testProcessor" class="... TestProcessor" scope="prototype"> >> <property name="path" value="/tmp/test/"/> >> </bean> >> >> protected AbstractXmlApplicationContext createApplicationContext() { >> ... >> TestProcessor testProcessor = (TestBean)ctx.getBean("testProcessor"); >> testProcessor.setPath("/another/path"); >> ... >> } >> >> public void test() { >> testProcessor.getPath() -> returns "/another/path" >> } >> >> but when the Processor is invoked by: >> >> public void test() { >> sendBody("activemq:topic:test", testuserCreatePayload); >> } >> >> the Processor has the default path "/tmp/test/" >> >> Alistair >> >> >> >> -- >> mov eax,1 >> mov ebx,0 >> int 80h >> >> >> >> >> On 6 Jul 2011, at 19:00, Claus Ibsen wrote: >> >>> On Mon, Jul 4, 2011 at 3:55 PM, Alistair Young <alistair.yo...@uhi.ac.uk> >>> wrote: >>>> Camel seems to load its own instances of beans in camel-config.xml >>>> >>>> testProcessor = (TestProcessor)ctx.getBean("testProcessor"); >>>> testProcessor.setPath("/home/test"); >>>> >>>> but when i do this: >>>> >>>> sendBody("activemq:topic:edirectoryprocessed", testuserCreatePayload); >>>> >>>> testProcessor has its old path. i.e. testProcessor.setPath("/home/test") >>>> has no effect in camel >>>> >>>> is there a way to load bean definition that camel will use during the test? >>>> >>> >>> Camel does not load its own instances. If you use spring with Camel, >>> it will lookup the beans from spring application context, and use >>> whatever spring returns to it. >>> >>> Whatever object you send from the producer template is send *as is*. >>> >>> >>> >>> >>>> thanks, >>>> >>>> Alistair >>>> >>>> >>>> -- >>>> mov eax,1 >>>> mov ebx,0 >>>> int 80h >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> FuseSource >>> Email: cib...@fusesource.com >>> Web: http://fusesource.com >>> Twitter: davsclaus, fusenews >>> Blog: http://davsclaus.blogspot.com/ >>> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/