You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding listeners to a step using the step builder, the step builder only broadcasts to listeners that use listener annotations, such as @OnReadError. Listeners that implement interfaces, such as "public class ExceptionListener implements ItemWriteListener", never receive broadcasted events.
Two files attached exemplifying a listener class that doesnt work (uses spring batch listener interfaces) and a listener clas that does work (uses listener annotations).
We have methods that accept each of the listeners. I think the issue is that you've implemented multiple interfaces on the same class which is causing java to pick the listener(Object listener) option instead of the one for the specific interface. We can improve this, but in the short term, a work around should be to cast to any of the interfaces you are implementing:
Let fluent setters of `SimpleStepBuilder` return `this` with type `SimpleStepBuilder`.
This makes the required order of some fluent setters a bit more lenient and prevents
that `AbstractTaskletStepBuilder::listener` for parameters of type `Object` is invoked
although an overloaded method specific for `SimpleStepBuilder` is intended.
Fixes#773 and #1098.
fmbenhassine
changed the title
StepBuilderFactory Only Supports Listener Annotations, Not Listener Interfaces [BATCH-2501]
StepBuilderFactory Only Supports Listener Annotations, Not Listener Interfaces
Jul 19, 2022
Jeff opened BATCH-2501 and commented
When adding listeners to a step using the step builder, the step builder only broadcasts to listeners that use listener annotations, such as
@OnReadError
. Listeners that implement interfaces, such as "public class ExceptionListener implements ItemWriteListener", never receive broadcasted events.Two files attached exemplifying a listener class that doesnt work (uses spring batch listener interfaces) and a listener clas that does work (uses listener annotations).
Affects: 3.0.6
Attachments:
The text was updated successfully, but these errors were encountered: