K.. I have gone through Spring reference manual and looked at ways to control
bean destroy. I tried using camelcontext id name defined in my config and
applied it to bean's depends-on attribute.  Unfortunately, spring cannot
find my camelcontext id name.  After some investigation, I came across this
link in Camel forum,

http://old.nabble.com/Spring-3.0-and-Camel-2.2---Route-configure%28%29-called-before-Spring-beans-injected-td28415437.html#a28415437

It appears only camelcontext id name "camel"  can be recognized by Spring
but not my custom camelcontext ids.  Camel hasn't registered my camelcontext
ids in Spring. Is there any other way to make bean depend on Camel route
through Spring DSL ?



Claus Ibsen-2 wrote:
> 
> Hi
> 
> I wonder if Spring has shutdown some of the JPA beans before it ask
> Camel to shutdown.
> So you may have to add some options on the spring beans. I wonder if
> the depends-on="camel" Spring attribute can be used so Spring will
> shutdown those spring beans AFTER camel.
> 
> On Thu, May 27, 2010 at 5:21 AM, vcheruvu <[email protected]>
> wrote:
>>
>> Hi,
>>
>> I am performing graceful shutdown test with our application.This is to
>> ensure Camel does process all of the messages from VM queue and shutdown
>> our
>> application. So, our application reads data from tables as a queue using
>> Camel-JPA Component. Please see my camel spring config in the attachment
>> below. I have ensured VM queue has about 100,000 Exchanges to be
>> processed
>> by storeNewOrderEventEntity route.  I tried to gracefully shut down Camel
>> from eclipse stop button. In doing so, I got error with
>> saveOrderEventRepository bean (this bean calls our DAO/repository layer
>> code
>> which calls store procedure at DB server to insert new records).
>>
>> Any idea how I can ensure this bean can defer getting destroyed and
>> ensure
>> all messages are processed before shutting down?
>>
>> http://old.nabble.com/file/p28689054/pats-camel-context.xml
>> pats-camel-context.xml
>>
>> 2010-05-27 11:24:40,915 ERROR [Camel thread 139:
>> vm://storeNewEntity?concurrentConsumers=100&size=1000000&timeout=1000000]
>> Logger.log:248 - Err
>> or processing exchange. Exchange[Message: OrderEventDTO
>> [AccountID=IGMKTS,
>> AdviserID=IGORDERS2, BrokerID=MQIGM, BuySell=SELL, ClOrdID=null, ClO
>> rdIDString=195, ClientCode=Y (DR), ComfirmationID=null, ContractID=6875,
>> CustomerOrderID=MQIGM, EventTyp
>> eCode=Partially Filled, ExchangeOrderID=20100413PTSGW0Y,
>> ExecID=6813:3641289, ExecutionInstructionCode=Market, ExpireTime=null,
>> ExternalOrderID
>> =1956282, FillContractID=null, FillPrice=null, FillSubaccountID=null,
>> FillVolume=null, HasChildren=null, OrderCategoryCode=Native, OrderDate=20
>> 10-04-13 07:29:13.0, OrderTypeCode=F, ParentClOrdID=null,
>> ParentClOrdIDString=null, Price=1986.75, ReferenceClOrdID=null,
>> ReferenceClOrdIDStrin
>> g=null, ReferenceExecID=null, ReferenceTradeDate=2010-04-13 07:29:13.0,
>> SourceSystem=PATS, StopPrice=0.0, TargetSystem=CME, Text= , TimeInForce
>> Code=Limit, TransactTime=2010-04-13 07:29:13.0, Volume=23,
>> ExternalSecondaryID=6320]]. Caused by:
>> [org.springframework.beans.factory.BeanCreationNotAllowedException -
>> Error
>> creating bean with name 'saveOrderEventRepository': Singleton bean
>> creation
>> not allowed while the singletons of t
>> his factory are in destruction (Do not request a bean from a BeanFactory
>> in
>> a destroy method implementation!)]
>> org.springframework.beans.factory.BeanCreationNotAllowedException: Error
>> creating bean with name 'saveOrderEventRepository': Singleton bean
>> creation
>> not allowed while the singletons of this factory are in destruction (Do
>> not
>> request a bean from a BeanFactory in a destroy method implementation!)
>>        at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:209)
>>        at
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>>        at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>>        at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>>        at
>> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
>>        at
>> org.apache.camel.spring.spi.ApplicationContextRegistry.lookup(ApplicationContextRegistry.java:52)
>>        at
>> org.apache.camel.component.bean.RegistryBean.lookupBean(RegistryBean.java:125)
>>        at
>> org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:56)
>>        at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:72)
>>        at
>> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:95)
>>        at
>> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:65)
>>        at
>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
>>        at
>> org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
>>        at
>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
>>        at
>> org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
>>        at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
>>        at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>        at
>> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>>        at
>> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>>        at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)
>>        at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>>        at
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>> --
>> View this message in context:
>> http://old.nabble.com/Exception-while-trying-to-gracefully-shutdown-camel-tp28689054p28689054.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Exception-while-trying-to-gracefully-shutdown-camel-tp28689054p28704698.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to