Java批处理框架:Easy Batch
Easy Batch是一个用于简化在Java进行批处理的框架。它提供了一些消除繁琐的任务模板代码,如读取、筛选、解析和验证输入数据,让你专注于你的批量处理业务逻辑。
该框架背后的动机是为了使您的开发生活更轻松。Easy Batch是一个轻量级的框架,你可以用流畅的Java API来进行配置。可运行在独立模式或嵌入在应用程序服务器中。
核心特性
Lightweight framework
The framework's core has no dependencies and hence a small memory footprint: a 80Ko jar file with a lot of features.
POJO-centric development
Easy Batch development is POJO-centric. It allows you to map data to domain objects so you can still work with the Object Oriented aspect of Java.
Declarative data validation
Easy Batch lets you declare data validation constraints on your domain objects and handles the validation code for you.
并发执行
Easy Batch allows you to run multiple engine instances in parallel to speed up execution and reduce processing time.
JMX monitoring
With Easy Batch, you can monitor your batch execution and progress using JMX in real time.
Modular architecture
Easy Batch architecture is modular and extensible through a consistent API. You can extend its components and integrate your own solutions.
Show me the code!
public class Launcher { public static void main(String[] args) throws Exception { // Build a batch engine Engine engine = new EngineBuilder() .reader(new FlatFileRecordReader(new File("data.csv"))) .filter(new HeaderRecordFilter()) .mapper(new DelimitedRecordMapper(Data.class)) .processor(new DataProcessor()) .build(); // Run the batch engine and get execution report Report report = engine.call(); } }