-
Apr 20th, 2010, 12:42 AM
#1
SimpleAsyncTaskExecutor configuration
Hi,
When i configured the SimpleAsyncTaskExecutor for jobLauncher , the step is not executing.The configuration is given below.
<beans:bean id="jobLauncher"
class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
<beans
roperty name="jobRepository" ref="jobRepository" />
<beans
roperty name="taskExecutor">
<beans:bean class="org.springframework.core.task.SimpleAsyncTa skExecutor" />
</beans
roperty>
</beans:bean>
And the job configuration is given below.
<job id="feedReaderJob">
<step id="feedLoadStep">
<tasklet>
<chunk reader="xmlFeedReader" writer="catalogItemWriter"
commit-interval="1" skip-limit="10">
<skippable-exception-classes>
java.lang.Exception
</skippable-exception-classes>
</chunk>
<listeners merge="true">
<listener ref="feedLoadStepListener" />
</listeners>
</tasklet>
</step>
</job>
The log is given below.
Apr 20, 2010 10:58:15 AM org.springframework.context.support.AbstractApplic ationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlAp plicationContext@bb6ab6: display name [org.springframework.context.support.ClassPathXmlAp plicationContext@bb6ab6]; startup date [Tue Apr 20 10:58:15 IST 2010]; root of context hierarchy
Apr 20, 2010 10:58:16 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [catalog/catalog-config.xml]
Apr 20, 2010 10:58:16 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'feedReaderJob': replacing [Generic bean: class [org.springframework.batch.core.job.flow.support.Si mpleFlow]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.job.flow.FlowJob]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
Apr 20, 2010 10:58:16 AM org.springframework.context.support.AbstractApplic ationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlAp plicationContext@bb6ab6]: org.springframework.beans.factory.support.DefaultL istableBeanFactory@1c695a6
Apr 20, 2010 10:58:16 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@1c695a6: defining beans [dataSource,transactionManager,org.springframework. aop.config.internalAutoProxyCreator,org.springfram ework.transaction.annotation.AnnotationTransaction AttributeSource#0,org.springframework.transaction. interceptor.TransactionInterceptor#0,org.springfra mework.transaction.config.internalTransactionAdvis or,jdbcTemplate,jobLauncher,jobRepository,itemWrit er,org.springframework.context.annotation.internal CommonAnnotationProcessor,org.springframework.cont ext.annotation.internalAutowiredAnnotationProcesso r,org.springframework.context.annotation.internalR equiredAnnotationProcessor,productDao,org.springfr amework.batch.core.scope.internalStepScope,org.spr ingframework.beans.factory.config.CustomEditorConf igurer,feedLoadStep,feedReaderJob,feedLoadStepList ener,catalogItemWriter,xmlFeedReader,catalogFeedRe ader,productMarshaller,mapConverter]; root of factory hierarchy
Apr 20, 2010 10:58:16 AM org.springframework.jdbc.datasource.DriverManagerD ataSource setDriverClassName
INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
Apr 20, 2010 10:58:17 AM org.springframework.context.support.AbstractApplic ationContext doClose
INFO: Closing org.springframework.context.support.ClassPathXmlAp plicationContext@bb6ab6: display name [org.springframework.context.support.ClassPathXmlAp plicationContext@bb6ab6]; startup date [Tue Apr 20 10:58:15 IST 2010]; root of context hierarchy
Apr 20, 2010 10:58:17 AM org.springframework.batch.core.launch.support.Simp leJobLauncher$1 run
INFO: Job: [FlowJob: [name=feedReaderJob]] launched with the following parameters: [{}]
Apr 20, 2010 10:58:17 AM org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@1c695a6: defining beans [dataSource,transactionManager,org.springframework. aop.config.internalAutoProxyCreator,org.springfram ework.transaction.annotation.AnnotationTransaction AttributeSource#0,org.springframework.transaction. interceptor.TransactionInterceptor#0,org.springfra mework.transaction.config.internalTransactionAdvis or,jdbcTemplate,jobLauncher,jobRepository,itemWrit er,org.springframework.context.annotation.internal CommonAnnotationProcessor,org.springframework.cont ext.annotation.internalAutowiredAnnotationProcesso r,org.springframework.context.annotation.internalR equiredAnnotationProcessor,productDao,org.springfr amework.batch.core.scope.internalStepScope,org.spr ingframework.beans.factory.config.CustomEditorConf igurer,feedLoadStep,feedReaderJob,feedLoadStepList ener,catalogItemWriter,xmlFeedReader,catalogFeedRe ader,productMarshaller,mapConverter]; root of factory hierarchy
I am not finding the issue.When i remove the task executor , the job is executing by using default synchronous task executor.
Can anybody has idea?Please help..
Regards,
Siva
Last edited by janapati.siva; Apr 20th, 2010 at 12:45 AM.
-
Apr 21st, 2010, 02:49 AM
#2
Maybe you ran the job from the command line and the VM exited before it had a chance to do anything? If you do that you need to block somewhere and wait for the job to finish (so if there's only one job there is no point using a non-default task executor), or use a thread pool that creates non-daemon threads.
-
Apr 26th, 2010, 03:52 AM
#3
I have multiple feed files to process.I want to process these files concurrently.
I have used the below configuration to process the feeds.
<!-- parallel processing of XML feeds configuration -->
<beans:bean id="xmlFeedReader" class="org.springframework.batch.item.file.MultiRe sourceItemReader" scope="step">
<beans
roperty name="resources" value="#{jobParameters[product_catalog_feed_path]}" />
<beans
roperty name="delegate" ref="catalogFeedReader" />
</beans:bean>
But MultiResourceItemReader process the files sequencially.What is the configuration to process the files concurrently?
-
Apr 26th, 2010, 04:11 AM
#4
Hi,
I am using spring batch 2.0
Is it possible to do parallel processing of feeds?
In spring batch2.1 i found the below configuration.
<step id="loading">
<tasklet task-executor="taskExecutor">...</tasklet>
</step>
But the same is not working in spring batch 2.0
-
Apr 27th, 2010, 11:07 AM
#5
You can use a task executor in a step in 2.0, but the XML schema is slightly different. Why not just upgrade though?
Anyway, that is a different use case than the one you described (processing multiple files concurrently, which is covered in a sample in 2.1, but should work in 2.0 as well - just the configuration would be different).
-
Apr 27th, 2010, 11:34 AM
#6
Thanks Dave,I got the sample example
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules