spring-batch

How does Spring Batch transaction management work?

狂风中的少年 提交于 2019-11-28 20:54:49
I'm trying to understand how Spring Batch does transaction management. This is not a technical question but more of conceptual one: what approach does Spring Batch use and what are the consequences of that approach? Let me try to clarify this question a bit. For instance, looking at the TaskletStep, I see that generally a step execution looks something like this: several JobRepository transactions to prepare the step metadata a business transaction for every chunk to process more JobRepository transactions to update the step metadata with the results of chunk processing This seems to make

ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

末鹿安然 提交于 2019-11-28 20:26:15
I have written a spring batch application using Spring boot. When I am trying to run that application using command line and classpath on my local system it is running fine. However, when I tried to run it on linux server it is giving me following exception Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. Below is the way I am running it: java -cp jarFileName.jar; lib\* -Dlogging.level.org.springframework=DEBUG -Dspring.profiles.active=dev

How Does Spring Batch Step Scope Work

狂风中的少年 提交于 2019-11-28 17:43:20
问题 I have a requirement where I need to process files based on the rest call in which I get the name of the file, I am adding it to the job parameter and using it while creating the beans. I am creating step scope Beans for (reader,writer) and using the job parameter.I am starting the job in a new thread as I am using asynchronus task exceutor to launch the job and my question is how will the beans be created by spring when we define @StepScope jobParametersBuilder.addString("fileName", request

What's the equivalent of Python's Celery project for Java?

心不动则不痛 提交于 2019-11-28 16:15:47
问题 I am trying to find an equivalent of Celery project for Java environment, I have looked at Spring Batch, but are there any better alternatives for distributed task queues. Thanks. 回答1: What Celery is doing is very much akin to EIP, and SEDA with convenient task scheduling... (all you have left to do is add some DB, and async HTTP networking and you have got a complete enterprise quality stack). Basically in Java there is the Spring way, the Java EE way, and the Hadoop way: Spring: Spring

Spring Boot Batch ResourcelessTransactionManager DataSourceProperties$DataSourceBeanCreationException

邮差的信 提交于 2019-11-28 14:39:17
I'm trying to setup a spring boot batch project that uses a ResourcelessTransactionManager transaction manager using Java Configuration, but I'm having no luck. The reason I am trying to do this is that I don't want any state persisted, and I'd prefer not to waste memory with hsqldb if I don't want it to begin with. I have an existing Spring Batch project that is not using Spring Boot, and it is working with no persistance and without hsqldb. I'm using this sample project as the base (but with hsqldb removed), and this other answer as a reference but I keep getting this exception: Caused by:

Spring Batch Admin + Spring Boot - Ambiguous mapping. Cannot map 'org.springframework.batch.admin.web.JobController#1' method

心不动则不痛 提交于 2019-11-28 12:22:55
问题 I am trying to have Spring Batch Admin UI using spring-batch-admin-samples project. My job uses Spring Boot and I have changed my main application class to be deployable to Weblogic using this link. So application class looks like, @SpringBootApplication(exclude = { HypermediaAutoConfiguration.class, MultipartAutoConfiguration.class }) @EnableBatchAdmin public class MyApplication extends SpringBootServletInitializer implements WebApplicationInitializer { @Override protected

Creating Indices name Dynamically in Elasticsearch using Spring-Data Elasticsearch

风流意气都作罢 提交于 2019-11-28 12:09:48
I have a use case where in need to create the indices per month in Elasticsearch. The idea is to create indices on the monthly bases so that they are easy to maintain and can be deleted when expired.For this to achieve i have used the spring-batch and have a monthly job which will create the indices on monthly bases For Elasticsearch-Java integration I have used the Spring-Data Elasticsearch implementation. The problem which i am facing now is, I am not able to figure out how to provide the dynamic-name to the index and mapping using the Entity object. My Current implementation is done keeping

Spring Batch: Commit-Interval not honored after roll back during write

ぃ、小莉子 提交于 2019-11-28 11:47:24
Say my commit interval is 1000. And during writing I get a error at 990th record which is skippable as per skip policy. So a rollback will occur and the writer will start again writing the same records from record 1. However, this time, It is commiting on each record. It does not honour commit interval. This is making the job dead slow. Why the behavior is like that ?? Am I missing something in my configuration ?? Thanks. that bevaviour is mandatory for spring batch to isolate the bad item(s), basically it rollbacks the chunk and processes/writes each item with commit-rate=1 to find the bad

Deploying two Spring batch applications in same cluster in a single Weblogic Domain?

旧时模样 提交于 2019-11-28 11:04:20
问题 BackGround - I am trying to deploy two spring batch applications as .war in same cluster in a single Weblogic Domain & each of them have spring batch admin console configured in servlet.xml like below - <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!--

SpringBatch - Get Line Number on FieldSetMapper

二次信任 提交于 2019-11-28 10:54:05
问题 I need to get the line number into the FieldSet Mapper. How can I do this? I want to use the lineNumber as a field of my resulting object produced by the Mapper. <beans:bean id="fileReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step"> <beans:property name="resource" value="file:${batch.source}"/> <beans:property name="lineMapper"> <beans:bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"> <beans:property name="lineTokenizer"> <beans:bean