spring-batch

Howcan I get started with Spring Batch?

I'm trying to learn Spring Batch, but the startup guide is very confusing. Comments like You can get a pretty good idea about how to set up a job by examining the unit tests in the org.springframework.batch.sample package (in src/main/java) and the configuration in src/main/resources/jobs. aren't exactly helpful. Also...

Spring: Getting FactoryBean object instead of FactoryBean.getObject()

Short question: If I have class that impelemnts FactoryBean interface, how can I get from FactoryBean object itself instead of FactoryBean.getObject()? Long question: I have to use 3-rd party Spring based library which is hardly use FactoryBean interface. Right now I always must configure 2 beans: <!-- Case 1--> <bean id="XYZ" class="F...

Spring Batch: java.io.IOException: Stream closed exception when combining MultiResourceItemWriter and FlatFileItemWriter

I have a Spring Batch process which takes a set of rows in the database and creates a number of flat files from those rows, 10 rows per file. To do this, I've created a Spring Batch process, similar to this: <batch:job id="springTest" job-repository="jobRepository" restartable="true"> <batch:step id="test"> <batch:tasklet> ...

Spring Batch resourceless JobRepository

Hello, I'm using Spring Batch for a system that does a lot of batch operations. I'm using SimpleJobRepository with in memory DAOs. I would like to know if there is a way to avoid using a JobRepository? something similar to the resourceless transaction manager? The reason i'm asking is that the system should run constantly without restart...

How can we share data between the different steps of a Job in Spring Batch?

Digging into Spring Batch, I'd like to know as to How can we share data between the different steps of a Job? Can we use JobRepository for this? If yes, how can we do that? Is there any other way of doing/achieving the same? Thanks, Karan ...

How to set up multi-threading in Spring Batch?

I've successfully set up a tutorial Spring Batch project. I'd really like to know if it's possible to make it multi-threaded at the "Spring level". The basic idea of what I want is to make a list of tasks or task steps and let them be picked up and worked on by independent threads, ideally out of a pool limited to 'n' number of threa...

skip-limit ignored for skippable exception thrown from writer

i am working on a project with spring batch 2.0.2 and have skippable exception set up in the config. for exceptions thrown from the processor everything works fine. it skips and once the limit is execeed the job fails (or stops). for exceptions thrown from the writer (same chunk) it keeps skipping. the skip-limit doesnt seem to matte...

Spring Batch validation

Hello. Does Spring Batch framework provide its specific validation mechanism? I mean, how it's possible to specify validation bean? Is spring Validator acceptable see example here ? My validation is result of @NamedQuery - if query returned result, the validation is OK, else - false. ...

Spring batch datareader returns extra null object on end of collection of read items?

I'm using Spring batch - using datareaders to load up lists of items. For each of my readers, they all return an extra null object on the end of the list. Has anybody seen this before? What am I doing wrong? ...

Ways to reduce memory churn

Background I have a Spring batch program that reads a file (example file I am working with is ~ 4 GB in size), does a small amount of processing on the file, and then writes it off to an Oracle database. My program uses 1 thread to read the file, and 12 worker threads to do the processing and database pushing. I am churning lots and ...

Spring batch JMS writer/reader example

Anybody know of a good resource for a detailed (more so than the Spring Batch docs) look at the uses of JMS Item Writer/Reader in Spring Batch? Specifically, and because I'm being tasked with trying to reuse an existing system whose only interface is asynchronous over a queue, I'm wondering if the following is possible: Step 1: read so...

Spring-Batch for a massive nightly / hourly Hive / MySQL data processing

I'm looking into replacing a bunch of Python ETL scripts that perform a nightly / hourly data summary and statistics gathering on a massive amount of data. What I'd like to achieve is Robustness - a failing job / step should be automatically restarted. In some cases I'd like to execute a recovery step instead. The framework must be ab...

Spring Batch: migrating 1 to n relationship where n is potentially huge

I am experienced with Spring, but new to Spring Batch. Now I have the task to migrate a data structure from a simple structure in one database to a complexer one in the other. The data structure corresponds to an object hierarchy that I will name like this OldParent 1 --> n OldChild // old system NewParent 1 --> n NewChild // new syst...

How to test "Too Many Files Open" problem.

I have a batch process that converts WAV to MP3 sequentially. The problem is that after a few thousand there are too many files left open, and it runs up against the file limit. The reason it does this is because of the code in SystemCommandTasklet: FutureTask<Integer> systemCommandTask = new FutureTask<Integer>(new Callable<Integer>()...

Spring Batch base step with listeners

I would like to setup a base step has a logger listener attached for making sure that all the error logs end up in the correct file. The setup below i simple enough and rather similar to the example presented on http://static.springsource.org/spring-batch/reference/html/configureStep.html#mergingListsOnStep but according http://www.spr...

How to send the data of 2 jdbc readers to one flat file using Spring Batch

I need to write a job in which i have to read the database 2 times. First query returns only one record and i need to send this record as the header of my flat file. Second query returns a set of records that i need to write in same flat file. I tried to create a compositewriter for it and within that i provided two flatFileItemWrite...

Optional job parameters in Spring Batch

Is it possible make a job parameter optional in the sense that it evaluates to null if it is not specified instead of throwing an exception? What I'm after is something like a <bean id="fileNamePattern" class="java.lang.String" scope="step"> <constructor-arg value="#{jobParameters[fileNamePattern]}" /> </bean> that I could pass ...

any sample for batch processing in hibernate ?

Can i find the example of batch processing in java hibernate so that i can run delete queries on two tables. ...

Get access to all spring beans of a given type

Hi, I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type. I understand that in Spring you should generally use IOC and let the container inject your beans. However in this case, I want to loop through a variable number of beans that extend a given cla...