Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to register an annotation-based StepExecutionListener in a fault-tolerant step #4137

Closed
fmbenhassine opened this issue Jun 21, 2022 · 0 comments
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: core type: bug
Milestone

Comments

@fmbenhassine
Copy link
Contributor

As of v4.3.6, it is not possible to register an annotation-based StepExecutionListener in a fault-tolerant step. The following snippet does not compile:

FaultTolerantStepBuilder builder = new StepBuilder("step")
   .repository(jobRepository)
   .transactionManager(transactionManager)
   .chunk(5)
   .reader(new DummyItemReader()) 
   .writer(new DummyItemWriter())
   .faultTolerant()
   .listener(new AnnotationBasedStepExecutionListener()); // compilation error here

This is because org.springframework.batch.core.step.builder.FaultTolerantStepBuilder#listener(java.lang.Object) returns SimpleStepBuilder while it should return FaultTolerantStepBuilder. Note how all other methods that are related to listener registration in the FaultTolerantStepBuilder class return FaultTolerantStepBuilder and not SimpleStepBuilder.


Reference: https://stackoverflow.com/questions/52167498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: core type: bug
Projects
None yet
Development

No branches or pull requests

1 participant