My itemReader in spring batch transforms a csv record into Consumer object. This object contains a property recordType which is either insert or update.The file which my itemReader transforms may contain mix of update and insert records. Now while writing in my itemWriter I need to transform the Consumer record either to InsertConsumerRecordDTO or UpdateConsumerRecordDTO based on the recordType property. This means I need either UpdateCustomerItemWriter or InsertCustomerItemWriter at run time .In short, the requirement I have is
if(record has insert)
Transform `Consumer` object to `InsertCustomerDTO`
use `InsertCustomerItemWriter` and make a REST call;
else
Transform `Consumer` object to `UpdateCustomerDTO`
use `UpdateCustomerItemWriter` and make a REST call
Is it possible to achieve this functionality with spring batch?