What is Easy Batch?
Welcome to the Easy Batch wiki! Easy Batch is a framework that aims to simplify batch processing with Java. It's goal is to free you from boilerplate code for tedious tasks such as reading, writing, filtering, parsing, validating data and let you concentrate on your batch processing business logic.
The motivation behind the framework is to make your life easier. Easy Batch is a lightweight framework that you can configure easily with a fluent Java API and run in a standalone mode or embedded in an application server.
|Implement business logic||x|
|Handle resources I/O||x|
|Data filtering / validation||x|
|Objects marshalling / unmarshalling||x|
|Logging / Reporting||x|
|Job Monitoring / Scheduling||x|
How does it work?
Easy Batch jobs are simple processing pipelines. Records are read in sequence from a data source, processed in pipeline and written in batches to a data sink:
Easy Batch provides the
Batch APIs to abstract data format and process records in a consistent way regardless of the data source/sink types.
Show me the code!
Let's suppose you have some tweets represented by a
Tweet class and you want to transform them from CSV to XML. Here is how to do it with Easy Batch:
Job job = JobBuilder.aNewJob() .named("transform tweets") .reader(new FlatFileRecordReader("tweets.csv")) .filter(new HeaderRecordFilter()) .mapper(new DelimitedRecordMapper(Tweet.class)) .marshaller(new XmlRecordMarshaller(Tweet.class)) .writer(new FileRecordWriter("tweets.xml")) .batchSize(10) .build(); JobExecutor jobExecutor = new JobExecutor(); JobReport report = jobExecutor.execute(job); jobExecutor.shutdown();
Easy Batch makes your code declarative, intuitive, easy to read, understand, test and maintain.