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)

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

19 questions
32
votes
5 answers

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 ---> ItemWriter#1 | ItemReader --->…
danidemi
  • 4,404
  • 4
  • 34
  • 40
20
votes
4 answers

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, InitializingBean { @Autowired private…
Fabio
  • 18,856
  • 9
  • 82
  • 114
2
votes
1 answer

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 ---> ItemProcessor#1 ---> ItemProcessor#2 …
Danilo Piazzalunga
  • 7,590
  • 5
  • 49
  • 75
2
votes
2 answers

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 into a file using FlatFileItemWriter, I'm not able…
pulikuttie
  • 35
  • 5
1
vote
1 answer

Access Job Parameter in Custom ItemProcessor

I am implementing a custom ItemProcessor in spring batch for processing data from a Rest api . I want access some values from jobParameter inside my ItemProcessor class . Any suggestion on how to do that ? In Tasklet we can access JobParameter…
Prashant Singh
  • 426
  • 7
  • 17
1
vote
1 answer

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 filename dynamically. Filename should be the respective…
pulikuttie
  • 35
  • 5
1
vote
1 answer

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 attempting to use Spring Batch for this, but I'm running…
SnoopDougg
  • 1,467
  • 2
  • 19
  • 35
1
vote
1 answer

NullPointerException when trying to read Database Queries in spring batch ItemProcessor

public class TransactionHistoryCsvItemProcessor implements ItemStream, ItemProcessor{ @Autowired private TransactionHistoryRepository transactionHistoryRepository; …
1
vote
1 answer

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 CopyOnWriteArrayList is being utilized for other threads and mix…
1
vote
1 answer

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 each row. I used a multi-threaded step with file…
Ping
  • 587
  • 5
  • 27
0
votes
1 answer

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 need to send an email to each subscriber as well…
balteo
  • 23,602
  • 63
  • 219
  • 412
0
votes
0 answers

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. FILE_HEADER MERCHANT_AND_CURRENCY_HEADER …
0
votes
1 answer

Updating a processed item in Spring Batch

I have a Spring Batch app that uses ItemProcessor to process items. @Component @StepScope public class MemberProcessor implements ItemProcessor { @Override public Member process(T t) throws Exception { return…
LaYapa
  • 1
0
votes
1 answer

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, the API response is an object with an array…
0
votes
1 answer

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) ItemProcessor - perform some validations on each…
rMonteiro
  • 1,371
  • 1
  • 14
  • 37
1
2