After batch consumption transaction is complete(BULK INSERTs), previously nothing is returned. Now we are passing the active record objects created back to consume_batch method so these records objects can be used by post_process hook method. Consumers can override this to do an action on the Active Record Models.
Note that these active record models are used by ActiveRecord-Import gem to bulk insert data. So record IDs are populated only if there is association involved.
Usecase: After saving records to Database, I queue a sidekiq job with record IDs.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update
How Has This Been Tested?
I ran the unit tests locally and this code change adds an empty post_process method in consumer. So it should not hurt any one upgrading to this version. For a meaningful use, they will have to override post_process in their consumers.
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
[x] Added an RSpec to note that the records are passed to post_process method
[ ] Couldnot add an RSpec to try both the branches of compacted and uncompacted messages. But I tried it locally by setting the parameter on consumer class.
Checklist:
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] I have added a line in the CHANGELOG describing this change, under the UNRELEASED heading
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
[ ] Any dependent changes have been merged and published in downstream modules
Pull Request Template
Description
After batch consumption transaction is complete(BULK INSERTs), previously nothing is returned. Now we are passing the active record objects created back to consume_batch method so these records objects can be used by
post_process
hook method. Consumers can override this to do an action on the Active Record Models.Note that these active record models are used by ActiveRecord-Import gem to bulk insert data. So record IDs are populated only if there is association involved.
Usecase: After saving records to Database, I queue a sidekiq job with record IDs. Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I ran the unit tests locally and this code change adds an empty
post_process
method in consumer. So it should not hurt any one upgrading to this version. For a meaningful use, they will have to overridepost_process
in their consumers.Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: