flipp-oss / deimos

Framework to work with Kafka, Avro and ActiveRecord
Other
59 stars 22 forks source link

post_process method outside batch consumption DB transaction #201

Closed harsha-flipp closed 6 months ago

harsha-flipp commented 10 months ago

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 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

Checklist:

harsha-flipp commented 6 months ago

Lionel tackled with these changes in his PR. I am closing this.