v5.0.0
The main theme of this new major release is less is more ❗ With this new version, Easy Batch has never been easier! Many APIs have been simplified and improved for more consistency and ease of use. Some APIs have been removed in order for you to do less work and delegate more to the framework 😄
After one year of active development, version 5.0.0 is finally here. This would not have been possible without the amazing open source community !! Many thanks to all contributors who suggested features, filed bugs and reported inconsistencies. I'm really grateful and thankful to all of you!
Version 5 is not 100% backward compatible with version 4. It introduces fundamental changes in the core framework in order to fix some inconsistent APIs. The processing workflow has been modified to improve performance.
This is the final release of v5.0 after many snapshot versions and 2 release candidates. Please find below the complete change log and a migration guide to help you move from v4 to v5.
Major changes
- issue #211 : Inconsistent Batch API
- issue #233 : Inconsistent RecordReader API
- issue #223 : Inconsistent RecordWriter API
- issue #227 : Inconsistent RecordDispatcher API
- issue #221 : Resource management should be handled by the framework
- issue #222 : Transaction management should be handled by the framework
- issue #230 : JobExecutor should use an ExecutorService
- issue #220 : Adapt listeners to batch processing workflow
New features
- issue #253 : Add MongoDBRecordMarshaller
- issue #251 : Add support for custom metrics
- issue #250 : Add java 8 stream support
- issue #248 : Add onConnectionOpened method in JobMonitoringListener
- issue #243 : add OpenCsvRecordMarshaller
- issue #242 : add XmlRecordValidator
- issue #241 : add option to activate/deactivate recursivity in FileRecordReader
- issue #224 : Add
RetryableRecordReader
- issue #225 : Add
RetryableRecordWriter
- issue #226 : Add
CompositeRecordWriter
Bug fixes
- issue #247 : onConnectionClosed in JobMonitoringListener is inconsistent
- issue #238 : FlatFileRecordReader should not throw a FileNotFoundException at construction time
- issue #170 : Unable to determine number of filtered record from batch
- issue #204 : Unnecessary generic type in
BeanValidationRecordValidator
- issue #209 : Unnecessary generic type in
BlockingQueueRecordReader
/BlockingQueueRecordWriter
- issue #228 : Job executionId is not coherent
- issue #229 : Job name is not a parameter
- issue #231 :
JobStatus.ABORTED
is redundant - issue #232 : Possible resource leak in
XmlWrapperTagWriter
Enhancements and API changes
- issue #252 : MongoDBRecordWriter should use bulk writes
- issue #249 : Update example in maven quick start archetype
- issue #236 : add constructor with java.nio.file.Path in FileRecordReader
- issue #239 : add constructor with java.nio.file.Path in FileRecordWriter
- issue #240 : add constructor with java.nio.file.Path in FlatFileRecordReader
- issue #244 : ApacheCommonCsvRecord is redundant
- issue #245 : ApacheCommonCsvRecordReader is redundant
- issue #246 : ApacheCommonCsvRecordMapper should be configurable with field names
- issue #234 :
RecordFieldExtractor
is poorly named - issue #235 :
BeanRecordFieldExtractor
is poorly named
Migration guide
JobBuilder
Methods deprecated in v4.2 have been removed in v5:
JobBuilder#skip(long)
JobBuilder#limit(long)
JobBuilder#timeout(long)
andJobBuilder#timeout(long, TimeUnit)
JobBuilder#silentMode(boolean)
JobBuilder#strictMode(boolean)
JobBuilder#jmxMode(boolean)
JobBuilder#call()
The keepAlive
parameter has been removed since resource handling is now done by the framework ( issue #221 ). Hence the following methods have been removed from JobBuilder
:
JobBuilder#reader(RecordReader recordReader, boolean keepAlive)
JobBuilder#reader(RecordReader recordReader, boolean keepAlive, RetryPolicy retryPolicy)
The "Retry Read" feature is now done with a decorator of RecordReader
(issue #224 ). Hence the method JobBuilder#reader(RecordReader recordReader, RetryPolicy retryPolicy)
has been removed
The RecordDispatcher
API has been removed. Hence, the method JobBuilder#dispatcher(RecordDispatcher recordDispatcher)
has been removed
JobExecutor
- The method
org.easybatch.core.job.JobExecutor.execute
is no more static, you need to create aJobExecutor
instance to execute jobs - Job executors must be shutdown explicitly
Resource handling & transaction management
- The constructors of
JdbcRecordReader/JdbcRecordWriter
now take a JDBCDataSource
as argument instead of aConnection
and theJdbcConnectionListener/JdbcTransactionListener
have been removed - The constructors of
JpaRecordReader/JpaRecordWriter
now take aEntityManagerFactory
as argument instead of aEntityManager
and theJpaEntityManagerListener/JpaTransactionListener
have been removed - The constructors of
HibernateRecordReader/HibernateRecordWriter
now take aSessionFactory
as argument instead of aSession
and theHibernateSessionListener/HibernateTransactionListener
have been removed
Moved APIs
org.easybatch.core.dispatcher.Predicate
has moved toorg.easybatch.core.writer.Predicate
org.easybatch.core.dispatcher.DefaultPredicate
has moved toorg.easybatch.core.writer.DefaultPredicate
org.easybatch.core.dispatcher.PoisonRecordBroadcaster
has moved toorg.easybatch.core.listener.PoisonRecordBroadcaster
Removed APIs
The Batch
class is no more a Record
. Instead, it now contains a list of records. Hence, all interfaces and implementations related to the previous inconsistent Batch
API have been removed: BatchReader
, BatchFilter
, BatchMapper
, BatchProcessor
, BatchMarshaller
, BatchValidator
and BatchWriter
.
The "record dispatcher" concept has been removed. All dispatchers have been transformed into writers:
BroadcastRecordDispatcher
->BlockingQueueRecordWriter
ContentBasedRecordDispatcher
->ContentBasedBlockingQueueRecordWriter
ContentBasedRecordDispatcherBuilder
->ContentBasedBlockingQueueRecordWriterBuilder
RoundRobinRecordDispatcher
->RoundRobinBlockingQueueRecordWriter
RandomRecordDispatcher
->RandomBlockingQueueRecordWriter
BroadcastJmsRecordDispatcher
->BroadcastJmsQueueRecordWriter
ContentBasedJmsRecordDispatcher
->ContentBasedJmsQueueRecordWriter
ContentBasedJmsRecordDispatcherBuilder
->ContentBasedJmsQueueRecordWriterBuilder
RandomJmsRecordDispatcher
->RandomJmsQueueRecordWriter
RoundRobinJmsRecordDispatcher
->RoundRobinJmsQueueRecordWriter
Exception handling have been simplified, the following exceptions have been removed:
org.easybatch.core.reader.RecordReaderOpeningException
org.easybatch.core.reader.RecordReaderClosingException
org.easybatch.core.reader.RecordReadingException
org.easybatch.core.processor.RecordProcessingException
org.easybatch.core.dispatcher.RecordDispatchingException
org.easybatch.core.field.RecordFieldExtractionException
org.easybatch.core.mapper.RecordMappingException
org.easybatch.core.marshaller.RecordMarshallingException
org.easybatch.core.validator.RecordValidationException
org.easybatch.core.writer.RecordWritingException
ApacheCommonCsvRecord
was removed. This is redundant with StringRecord
.
ApacheCommonCsvRecordReader
was removed. This is redundant with FlatFileRecordReader
.
Other changes
org.easybatch.core.processor.ComputationalRecordProcessor
deprecated in v4.2 has been removedJobResult
deprecated in v4.2 has been removed fromJobReport
, this is related to the removal ofComputationalRecordProcessor
- All constructors in
XmlWrapperTagWriter
now take aFile
instead ofFileWriter
, this is due to a resource leak BeanValidationRecordValidator
is no more parametrized typePredicate
is no more a parametrized typeBlockingQueueRecordReader
is no more a parametrized typeBlockingQueueRecordWriter
is no more a parametrized typeRecordFieldExtractor
interface has been renamed toFieldExtractor
BeanRecordFieldExtractor
class has been renamed toBeanFieldExtractor