-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Migrating JSR 352 ItemReader/ItemWriter "checkpointInfo()" to Spring Batch 5 equivalent #4629
Unanswered
abhinaswale
asked this question in
Q&A
-
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";
}
}
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
The equivalent is ItemStream#update
. This is where checkpointing happens (ie updating the context with restart data). Have you tried that?
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment