What is the best practise around APOC triggers:
Is it disadvised to put business logic in them?
What kinds of logic should go in them, and how much?
Will logic in there tend to grow to a maintainability burden over time?
I imagine one might have APOC triggers that fire events, which then get picked up by Kafka or similar, which trigger a Cloud Function that performs some task/query.
But I am drawn between two opposing viewpoints:
It would be much more efficient to have business logic in the database layer, since then you don't need to send messages over the network (potentially back/forth to another data center, if the DB is hosted elsewhere than where the Cloud Functions run).
I don't think it is wise to put business logic inside APOC triggers. Because:
- it doesn't seem best practise to put business logic into database transaction handlers like that.
- it requires institutional knowledge of Java (whereas one might only be using TypeScript or Go in the app/service layer).
- it increases vendor lock-in, if one later wants to swap out the database.
What are the best practises here, both in terms of efficiency and maintainability?