Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The simple, stupid batch framework for Java

License

NotificationsYou must be signed in to change notification settings

j-easy/easy-batch

Repository files navigation


Easy Batch
The simple, stupid batch framework for Java™

MIT licenseBuild StatusMaven CentralJavadocProject status


Project status

As of November 18, 2020, Easy Batch is in maintenance mode. This means only bug fixes will be addressed from now on.Version 7.0.x is the only supported version.

Latest news

What is Easy Batch?

Easy Batch is a framework that aims at simplifying batch processing with Java. It wasspecifically designed for simple, single-task ETL jobs.Writing batch applications requires alot of boilerplate code: reading, writing, filtering, parsing and validating data, logging, reporting to name a few..The idea is to free you from these tedious tasks and let you focus on your batch application's logic.

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:

batch processing

The framework provides theRecord andBatch APIs to abstract data format and process records in a consistent way regardless of the data source/sink type.

Let's see a quick example. Suppose you have the followingtweets.csv file:

id,user,message1,foo,hello2,bar,@foo hi!

and you want to transform these tweets to XML format. Here is how you can do that with Easy Batch:

PathinputFile =Paths.get("tweets.csv");PathoutputFile =Paths.get("tweets.xml");Jobjob =newJobBuilder<String,String>()         .reader(newFlatFileRecordReader(inputFile))         .filter(newHeaderRecordFilter<>())         .mapper(newDelimitedRecordMapper<>(Tweet.class,"id","user","message"))         .marshaller(newXmlRecordMarshaller<>(Tweet.class))         .writer(newFileRecordWriter(outputFile))         .batchSize(10)         .build();JobExecutorjobExecutor =newJobExecutor();JobReportreport =jobExecutor.execute(job);jobExecutor.shutdown();

This example creates a job that:

  • reads records one by one from the input filetweets.csv
  • filters the header record
  • maps each record to an instance of theTweet bean
  • marshals the tweet to XML format
  • and finally writes XML records in batches of 10 to the output filetweets.xml

At the end of execution, you get a report with statistics and metrics about the job run (Execution time, number of errors, etc).All the boilerplate code of resources I/O, iterating through the data source, filtering and parsing records, mapping data to the domain objectTweet, writing output and reportingis handled by Easy Batch. Your code becomes declarative, intuitive, easy to read, understand, test and maintain.

Quick start

Add the following dependency to your project and you are ready to go:

<dependency>    <groupId>org.jeasy</groupId>    <artifactId>easy-batch-core</artifactId>    <version>7.0.2</version></dependency>

You can also generate a quick start project with the following command:

$>mvn archetype:generate \      -DarchetypeGroupId=org.jeasy \      -DarchetypeArtifactId=easy-batch-archetype \      -DarchetypeVersion=7.0.2

For more details, please check theGetting started guide.

Presentations, articles & blog posts

Current versions

Stable:

The current stable version isv7.0.2 |documentation |tutorials |javadoc

Development:

The current development version is 7.0.3-SNAPSHOT:Build Status

If you want to import a snapshot version, please check theGetting started guide.

Contribution

You are welcome to contribute to the project with pull requests on GitHub.Please note that Easy Batch is inmaintenance mode,which means only pull requests for bug fixes will be considered.

If you believe you found a bug or have any question, please use theissue tracker.

Awesome contributors

Thank you all for your contributions!

Who is using Easy Batch?

Easy Batch has been successfully used in production in a number of companies which I (@benas) am not allowed to mention.That said, there are some companies which publicly mention that they use Easy Batch:

You can also find some feedback from the community about the project in theTestimonials section.

Credits

YourKit Java Profiler

Many thanks toYourKit, LLC for providing a free license ofYourKit Java Profiler to support the development of Easy Batch.

License

Easy Batch is released under the terms of theMIT license.

The MIT License (MIT)Copyright (c) 2021 Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.

About

The simple, stupid batch framework for Java

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp