Event on Data change

2
Good Morning, I have the following situation. I have a published API that is returning an object with a few associated objects. The JSON response has about 30 lines. I now need to trigger an event (kafka event) whenever something changes (A value on my main object or the association to any of the associated objects). My idea was to perform the following action in the before commit microflow of my main object. retrieve the old version of the object from the database apply the export mapping from the API to the old and the new version compare the result strings If the strings are different, create the event The benefit would be that if the api changes in the future (additional attributes, additional associations), this logic would still work. But for some reason there is this little voice in my head screaming “are you sure?” Any thoughts on why I should not do it like this? Any alternative suggestions? Any thoughts on why it is a good idea to do it like this?
asked
2 answers
2

Good question. For my oppinion you should think about if it is necessry to run this comparancy every time when the object is committed or only in the situation where you need to compare it with your rest service. In your way it would run every time in the before commit . But it depends on your specific use case.

answered
1

An elegant sollution imho. I can not find a flaw in it. I am curious about the result because this might be a sollution for a problem I have in a project. So kudo’s for sharing.

Regards,

Ronald

 

answered