j-easy / easy-batch

The simple, stupid batch framework for Java
https://github.com/j-easy/easy-batch/wiki
MIT License
611 stars 199 forks source link

Deprecate ContentBasedBlockingQueueRecordWriterBuilder #379

Closed fmbenhassine closed 4 years ago

fmbenhassine commented 4 years ago

The ContentBasedBlockingQueueRecordWriterBuilder has no added value in regard to the configuration of ContentBasedBlockingQueueRecordWriter. This:

ContentBasedBlockingQueueRecordWriter writer = ContentBasedBlockingQueueRecordWriterBuilder.newContentBasedBlockingQueueRecordWriterBuilder()
        .when(new CsvFilePredicate()).writeTo(csvQueue)
        .when(new XmlFilePredicate()).writeTo(xmlQueue)
        .build();

has no real added value compared to:

Map<Predicate<Path>, BlockingQueue<Record<Path>>> queueMap = new HashMap<>();
queueMap.put(new CsvFilePredicate(), csvQueue);
queueMap.put(new XmlFilePredicate(), xmlQueue);
ContentBasedBlockingQueueRecordWriter<Path> writer = new ContentBasedBlockingQueueRecordWriter<>(queueMap);

other than more code to maintain on the framework side. This builder should be deprecated in v6.1 and removed in v6.2 or later.