Hello. I love Camel and am using it for my product.
I set my bean in the spring custom thread(prototype) scope, And I configure the camel route the below <beans> ... <bean id="myBean" class="com.brm.test.MyBean" scope="thread" init-method="start" destroy-method="stop"> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> ... <route> <from uri="seda:test" /> <threads poolSize="10" maxPoolSize="20"> <setExchangePattern pattern="InOnly" /> <to uri="bean:myBean?method=process" /> </threads> </route> ... </camelContext> ... </beans> When I send message to seda:test, In myBean the init-method start() was called ok. But I have not seen the destroy-method stop() at all in the spring thread(prototype) scope. My bean maintains some resources in its life cycle as the thread scope or the prototype scope. But I don't know how to clear the resources of myBean when the thread using myBean is discared or bean is destoryed. If spring destroy-method is not applicable, Is Some camel listener possible ? Could someone help me? Thanks a lot before.