Dry run mode in LM task
@andrus , please approve
I guess I don't understand the point of "dryRun"
Kind of "preview" mode, that lets you inspect the changes without committing them.
If I understand correctly, the use case for this is to collect changes, and then handle them using custom code via a listener? I was hoping we can actually encapsulate @rzen 's case in a separate task that will not require a listener. Like "SoftDeleteTask"
Yeah, but my point is that it's not necessarily the only use case in which "undoing" of changes might be required.
One particular example would be a two-step user approval:
- task is executed, and changes are accumulated in Cayenne context; nothing is committed
- user inspects the changes (simple stats or more thorough per-attribute inspection)
- user approves, and the changes are committed into target With this PR, all that is required to implement such use case would be to capture the ObjectContext. Which might also be exposed in some non-listener API...
Another use case is testing the jobs without actually committing anything. And stage listeners can inspect Execution.isDryRun() in order to prevent sending notifications or doing some other stuff.
In fact I'm not too strong on this one, so feel free to close if it seems to do more harm than good
I think dry run is an interesting idea independent of my original request.
Even more useful if instead of in the code it could be enabled in extractor descriptor.
Something along the lines of:
<config>
<type>jdbc</type>
<connectorId>connector</connectorId>
<attributes>
...
</attributes>
<properties>
<extractor.dryrun>true</extractor.dryrun>
...
</properties>
</config>