Questions tagged [itemprocessor]

ItemProcessor is an interface for item transformation in Spring Batch applications. Given an item as input, this interface provides an extension point which allows for the application of business logic in an item oriented processing scenario. (This tag must be used only with spring-batch posts)

Filter by
Sorted by
Tagged with
33 votes
5 answers
46k views

Spring Batch: One reader, multiple processors and writers

In Spring batch I need to pass the items read by an ItemReader to two different processors and writer. What I'm trying to achieve is that... +---> ItemProcessor#1 ---> ...
danidemi's user avatar
  • 4,586
22 votes
4 answers
31k views

Return multiple items from spring batch ItemProcessor

I'm writing a spring batch job and in one of my step I have the following code for the processor: @Component public class SubscriberProcessor implements ItemProcessor<NewsletterSubscriber, Account&...
Fabio's user avatar
  • 19.1k
2 votes
1 answer
1k views

Multiple ItemProcessors and ItemWriters in the same Spring Batch step

Can I write a Spring Batch step with a single ItemReader and multiple substeps, each with an ItemProcessor followed by a ItemWriter? I am trying to achieve something like this: ItemReader ---> item ...
Danilo Piazzalunga's user avatar
2 votes
2 answers
2k views

Can I use FlatFileItemWriter to write multi-format file in Spring Batch?

I'm reading a multi-format file using FlatFileItemReader and mapping every line to its corresponding bean type in ItemProcessor and performing data enrichment. But when I try to write these records ...
pulikuttie's user avatar
1 vote
1 answer
878 views

Why is exception in Spring Batch AsycItemProcessor caught by SkipListener's onSkipInWrite method?

I'm writing a Spring Boot application that starts up, gathers and converts millions of database entries into a new streamlined JSON format, and then sends them all to a GCP PubSub topic. I'm ...
SnoopDougg's user avatar
  • 1,577
1 vote
1 answer
599 views

Access Job Parameter in Custom ItemProcessor

I am implementing a custom ItemProcessor<I, O> in spring batch for processing data from a Rest api . I want access some values from jobParameter inside my ItemProcessor class . Any suggestion on ...
Prashant Singh's user avatar
1 vote
1 answer
1k views

Pass filenames dynamically to FlatFileItemWriter through StepBuilderFactory stream() when using ClassifierCompositeItemProcessor in SpringBatch

I'm processing multiple input files with multi-format lines using ClassifierCompositeItemProcessor. But when using StepBuilderFactory stream to write the files, I'm unable to pass the Resource ...
pulikuttie's user avatar
1 vote
1 answer
1k views

NullPointerException when trying to read Database Queries in spring batch ItemProcessor

public class TransactionHistoryCsvItemProcessor implements ItemStream, ItemProcessor<TransactionHistory,TransactionHistory>{ @Autowired private ...
srikanth m's user avatar
1 vote
1 answer
240 views

Spring Batch partition doesnt work composite itemprocessor

I have a Spring Batch partition job. I’m using CompositeProcessor, read data from DB and save these items into an CopyOnWriteArrayList. Because the environment is concurrent but my ...
peter santos's user avatar
1 vote
1 answer
2k views

Spring Batch: Multithreaded step with AsyncItemProcessor doesn't run in parallel

TL;DR Given a file with a million reocrds where there is considerable amount of logic to be executed on each row in the file, what is the fastest way to read the file and finish applying the logic on ...
Ping's user avatar
  • 607
0 votes
1 answer
492 views

Spring-batch ItemProcessor data in the form of a list to model

I'm using a custom itemReader to read data from an external rest API, and it's working great. However, the problem arises when processing the data with ItemProcessor into my model class. Unfortunately,...
tagikis845's user avatar
0 votes
1 answer
1k views

How to know if it is the last item in ItemProcessor of SpringBatch

I have the following ItemProcessor, I need to know if the item is the last item the reader sends. Is this possible? The flow is: ItemReader - read lines from database (expected millions of lines) ...
rMonteiro's user avatar
  • 1,526
0 votes
1 answer
333 views

Spring Batch @BeforeContext Fails to Execute

I have a situation in spring batch where I have multiple item processors that make up a composite item processor. I need to share some context data between two processors in the same step. I have ...
user avatar
0 votes
1 answer
468 views

Clarification needed with Spring batch concepts

I am new at Spring batch and I am having an issue implementing my business use case with Spring batch. Basically, I am reading data from a database i.e. a List of subscribers to a newsletter. I then ...
balteo's user avatar
  • 24.1k
0 votes
0 answers
28 views

spring batch issues : split my output into differents files

Hi everyone im pretty new with spring and spring batch. I have a file in input with multiple row and data. I want to redirect the row in a specific file depending to the data in the row. Its something ...
Hurtcraft's user avatar
0 votes
0 answers
25 views

Write multiple groups/batch with header and trailer using spring batch

I want to generate a file with financial transactions similar to the following format. Basically transactions are grouped by merchant and currency. Each group has a separate header and trailer. ...
Hesitha Wijayasinghe's user avatar
0 votes
1 answer
914 views

Updating a processed item in Spring Batch

I have a Spring Batch app that uses ItemProcessor to process items. @Component @StepScope public class MemberProcessor<T> implements ItemProcessor<T, Member> { @Override public ...
LaYapa's user avatar
  • 1
0 votes
0 answers
958 views

Spring Batch + MongoItemReader, ItemProcessor, MongoItemWriter + not reading all records

I'm using Spring Batch with Mongo database. I need to get the documents based on status (status=PENDING), write in a Kafka queue and update documents field with new status(status=FILLED). So I used a ...
Naveen's user avatar
  • 1
0 votes
2 answers
861 views

To separate steps class in spring batch

I have tried to find the solution but I cannot... ㅠㅠ I want to separate steps in a job like below. step1.class -> step2.class -> step3.class -> done The reason why I'm so divided is ...
Joonseo Lee's user avatar
0 votes
0 answers
209 views

Generate new Items / CSV-Rows in Spring Batch Processor in Batch Job

Summary : I need to export some CSV Files with Rows that are generated during Batch export. I already do have an JdbcItemreader to get the Data from my DB. The Processor formats the OutputData to the ...
eckad158's user avatar
  • 395