Java批處理框架:Easy Batch

jopen 9年前發布 | 92K 次閱讀 常用工具包 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();
    }
}



項目主頁:http://www.baiduhome.net/lib/view/home/1425265819790

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!