How to log last changes in hybris when the new feed/ feeds updates come through

Total
2
Shares

I’m aware that Hybris have savedvaluesmodel and savedvalueentrymodel to capture last changes of the data model and its attribute value whatever has changed recently, and it also maintains the history.

And this works only if we are modifying the data after login into Backoffice and this doesn’t seem to work in case of feeds which comes via HotFolder. I’d like to know, is there any provision which comes with Hybris out of the box to capture the same information or changes that was done for a given data model through feed?

What I have observed based on OOTB code is ,this class DefaultItemModificationHistoryService is responsible for logging the changes (populate the values and saved the last changes into the saved values model table) that was done at the model level, and this is located inside the OOTB Backoffice extension and this extension is already extended by myprojectbakcoffice extension which further extends myprojectcore extension.

In order to capture the last changes done via feed we thought of handling that logic in an interceptor, however the above class isn’t accessible in our myprojectcore extension as it’s declared in Backoffice.

What are the other possible solutions that I can think of in order to implement this?

Found some article related to this in here.

Please advise.


Solution

You can use the hybris commerce audit framework to log all of the changes happening in the system.

The documentation here says, "Generic audit tracks every persistence action, including creation, modification, and deletion for specified types. The audit is stored as a change log that allows you to see how an item changed over time."

But this comes with a DB overhead. There are specific tables that gets heavily logged with the details of the changes.

These tables have a naming convention as <item_type>_sn. 
E.g.: For Order item type, the audit table would be auto created as orders_sn

This is why it is always advisable to turn off the audit as applicable.

Leave a Reply

Your email address will not be published. Required fields are marked *