Code Monkey home page Code Monkey logo

easy-batch's Introduction


Easy Batch
The simple, stupid batch framework for Javaโ„ข

MIT license Coverage Build Status Maven Central Javadoc Gitter


Latest news

  • 07/02/2020: Version 6.0.0 is now released! This is definitely the best release ever and comes with a number of significant improvements! See the change log here.
  • 14/01/2020: Version 5.3.0 is finally out! See the change log here.

What is Easy Batch?

Easy Batch is a framework that aims to simplify batch processing with Java. It was specifically designed for simple ETL jobs. Writing batch applications requires a lot 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 the Record and Batch APIs to abstract data format and process records in a consistent way regardless of the data source type.

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

id,user,message
1,foo,hello
2,bar,@foo hi!

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

Path inputFile = Paths.get("tweets.csv");
Path outputFile = Paths.get("tweets.xml");
Job job = new JobBuilder()
         .reader(new FlatFileRecordReader(inputFile))
         .filter(new HeaderRecordFilter())
         .mapper(new DelimitedRecordMapper(Tweet.class, "id", "user", "message"))
         .marshaller(new XmlRecordMarshaller(Tweet.class))
         .writer(new FileRecordWriter(outputFile))
         .batchSize(10)
         .build();

JobExecutor jobExecutor = new JobExecutor();
JobReport report = jobExecutor.execute(job);
jobExecutor.shutdown();

This example creates a job that:

  • reads records one by one from the input file tweets.csv
  • filter the header record
  • map each record to an instance of the Tweet bean
  • marshal the tweet to XML format
  • and finally write XML records in batches of 10 to the output file tweets.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 object Tweet, writing output and reporting is 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>6.0.0</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=6.0.0

For more details, please check the Getting started guide.

Presentations, articles & blog posts

Current versions

Stable:

The current stable version is v6.0.0 | documentation | tutorials | javadoc

Development:

The current development version is 6.0.1-SNAPSHOT: Build Status

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

Contribution

You are welcome to contribute to the project with pull requests on GitHub.

If you find a bug or want to request a feature, please use the issue tracker.

For any further question, you can use the gitter channel of the project.

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, here are some companies who publicly mention that they use Easy Batch:

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

Credits

YourKit Java Profiler

Many thanks to YourKit, LLC for providing a free license of YourKit Java Profiler to support the development of Easy Rules.

License

Easy Batch is released under the MIT license.

The MIT License (MIT)

Copyright (c) 2020 Mahmoud Ben Hassine ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, 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 IN
THE SOFTWARE.

easy-batch's People

Contributors

aussieguy0 avatar ayman-abdelghany avatar aymandf avatar chellan avatar chsfleury avatar danielbarcellos avatar danieles82 avatar fmbenhassine avatar gitter-badger avatar ipropper avatar ivanatanasov89 avatar jlleitschuh avatar malpi avatar nihed avatar pascalschumacher avatar toilal avatar verdi8 avatar xenji avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.