Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrating JSR 352 ItemReader/ItemWriter "checkpointInfo()" to Spring Batch 5 equivalent #4629

Unanswered
abhinaswale asked this question in Q&A
Discussion options

I am in process to migrate JSR 352 batch job to Spring Batch 5 job.
While migrating I could map open() & close() methods from JSR352 to the target state (as equivalents are available in ItemStreamWriter). However, I didn't find a way to migrate **checkpointInfo()** method to Spring Batch. Any pointers on the approach?

import javax.batch.api.chunk.ItemWriter;
import java.util.logging.Logger;
public class CustomWriter implements ItemWriter {
 private static final Logger LOGGER = Logger.getLogger(CustomWriter.class.getCanonicalName());
 @Override
 public void open(Serializable checkpoint) throws Exception { 
 // some logic
 LOGGER.logp(Level.FINE, CustomWriter.class.getSimpleName(), "open()", "I am opening writing");
 }
 @Override
public void close() throws Exception { 
 // some logic
 LOGGER.logp(Level.FINE, CustomWriter.class.getSimpleName(), "close ()", "I am closing down writing");
 }
 @Override
 public void writeItems(List<Object> items) throws Exception { 
 // some logic
 LOGGER.logp(Level.FINE, CustomWriter.class.getSimpleName(), "writeItens()",
 "I am writing this number of lines: " + items.size());
 }
 @Override
 public Serializable checkpointInfo() throws Exception {
 // some logic
 return "No op writer";
 }
}
You must be logged in to vote

Replies: 1 comment

Comment options

The equivalent is ItemStream#update. This is where checkpointing happens (ie updating the context with restart data). Have you tried that?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter

AltStyle によって変換されたページ (->オリジナル) /